#part position changes when touching another part

1 messages · Page 1 of 1 (latest)

uneven swift
#

You need to make a script in the door

cunning relicBOT
#

studio** You are now Level 2! **studio

crisp prawn
#

What do you mean "change position"?

#

You want to just move to another place or just open like a normal door?

#

And what part you need to touch? Any?

#

Create a script inside the part you need to touch, create a few variables: one for door, one for the touching part
Now when you touch the part, change the door position
Something like this:

local TouchPart = ...
local Door = ...
TouchPart.Touched:Connect(function(hit)
  if hit.Parent:FindFirstChild("Humanoid") then
    Door.Position = Vector3.new(x, y, z)
  end
end)
#

It will teleport the door even if a player touch that specific part

#

You know how to get a path of an instance, right?

#

Huh.... I tbh can't explain, but its pretty easy... You know how to get the path of a file inside your computer? Its almost the same way for Roblox

#

Open a random file in your computer and you can see this path
it will be different for your

#

Now if you go to a folder back, it will be (10/10 editing)

#

Same in Roblox Studio, you have your "file" (instance) that has a path form the main "computer" (game)

#

So, if you want to take "Door" and "TouchPart" from this:

#

You need to do something like this:

local Door = game.Workspace.Door
--and
local TouchPart = game.Workspace.PartsModel.TouchPart
#

Awesome! Practice more and you will learn, try to have fun while learning