Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

How do I make a player touch a pad or so and make a model move up?

bool = false
open = script.Parent.Parent.Open2
position1 = -119.18, 4.5, 235.79
position2 = -119.18, 5.9, 233.39
position3 = -119.18, 4.5, 235.59
position4 = -119.18, 4.5, 237.19
function opened(hit)
	if bool == false then
		if script.Parent:FindFirstChild('Humanoid') then
			if script.Parent.Parent then
				wait()
				open.Position = position1
				wait(1)
				open.Position = position2 
				wait(1)
				open.Position = position3 
				wait(1)
				open.Position = position4
				bool = true
			end
		end
	end
end

script.Parent.Parent.Open2.Touched:connect(opened)

So when the player step on the part I want the model of the part to open.

2 answers

✓ Accepted answer

You're trying to set one variable to three different values. The variable is only being set to the first value. Since you're setting a Position to this value, you must mean to be defining the variable as a Vector3 with those components. In that case, write Vector3.new(-119.18, 4.5, 235.79), etc.

First off, your initialization of the position values need to be Vector3's:

position1 = Vector3.new(-119.18, 4.5, 235.79)
position2 = Vector3.new(-119.18, 5.9, 233.39)
position3 = Vector3.new(-119.18, 4.5, 235.59)
position4 = Vector3.new(-119.18, 4.5, 237.19)

Now, I'm also assuming open is a Model. Models don't have a Position property, but you can use the MoveTo method to transform a Model's position:

open:MoveTo(position2)

EDIT: the above is wrong. Just saw you were attaching a .Touched event to open, so it's obviously a part. No need to use the MoveTo method.

This discussion is preserved as it was. New answers, comments, and votes are closed.