Problem with up down animation door

Hello sorry if the question is too dump but i trying to make an up and down animation and is not working for some reason
here’s the script:

local part = script.Parent
local ProximityPrompt = script.Parent.ProximityPrompt
local canOpen = true

part.Position = part.Position + Vector3.new(0,12,0)

part.Position = part.Position + Vector3.new(0,-12,0)

ProximityPrompt.ActionText = "Open"

canOpen = false

ProximityPrompt.Triggered:Connect(function()
	if ProximityPrompt.ActionText == "Close" then
		canOpen = true
		ProximityPrompt.ActionText = "Open"
	else
		canOpen = false
		ProximityPrompt.ActionText = "Close"
	end
end)
1 Like

Never say questions are too dumb, this is the #help-and-feedback:scripting-support category :sweat_smile:

What exactly isn’t working? If you can, do add some print statements to check what works & what doesn’t

1 Like

I see that the print work but is not working the animation for some reason…

Is the animation supposed to be in another script? Also I’m not sure but you assigned the part.Position properties at the start of the script? Did you mean to put them inside the if statements?

Is not other script for the animation.I want that when activate the proximity prompt the animation runs and the part goes up and when you press other time the part goes down. :sweat_smile:

Sorry but i not script that much with: tween,CFrame or any sort of animation…


ProximityPrompt.Triggered:Connect(function()
	if ProximityPrompt.ActionText == "Close" then
		canOpen = true
		ProximityPrompt.ActionText = "Open"
	else
		canOpen = false
		ProximityPrompt.ActionText = "Close"
	end
end)

You’re just setting canOpen and changing the action text, not actually moving anything.

ProximityPrompt.Triggered:Connect(function()
	if ProximityPrompt.ActionText == "Close" then
		canOpen = true
                part.Position = part.Position + Vector3.new(0,12,0)
		ProximityPrompt.ActionText = "Open"
	else
		canOpen = false
                part.Position = part.Position + Vector3.new(0,-12,0)
		ProximityPrompt.ActionText = "Close"
	end
end)
2 Likes

Thanks so much! i really appreciated!

1 Like

You’re welcome. Always happy to help someone

1 Like