local loc = false -- false = down, true = up
local goal = {}
goal.Position = script.Parent.Position + Vector3.new(0,10,0)
local goal2 = {}
goal2.Position = script.Parent.Position - Vector3.new(0,10,0)
local tweenInfo = TweenInfo.new(7.5)
local tweenUp = TweenService:Create(script.Parent, tweenInfo, goal)
local tweenDown = TweenService:Create(script.Parnt, tweenInfo, goal2)
script.Parent.ProximityPrompt.Triggered:Connect(function()
if loc == false then
script.Parent.Anchored = false
tweenUp:Play()
loc = true
script.Parent.Anchored = true
elseif loc == true then
script.Parent.Anchored = false
tweenDown:Play()
loc = false
script.Parent.Anchored = true
end
end)
it doesn’t play the tweens or the tweens aren’t doing anything, here’s a screenshot of it
I would recommend adding print statements to see what lines of code are running (this is a common method of debugging code). Also, is there any specific reason that you un-anchor and re-anchor the part? Tweens can move anchored stuff because they’re setting the properties instead of using physics like a body mover. Also, if you’re creating a tweening gate you should probably set one of the goals to the original position and the other to a higher location.
local TweenService = game:GetService("TweenService")
at the top. You also misspelled Parent here:
local tweenDown = TweenService:Create(script.Parnt, tweenInfo, goal2)
I highly recommend running your code and looking for errors in the output. You can get to the output by going to View → Output. If you misspell something or forgot to declare something the output will tell you.
local TweenService = game:GetService("TweenService")
local loc = false -- false = down, true = up
local goal = {}
goal.Position = script.Parent.Position + Vector3.new(0,10,0)
local goal2 = {}
goal2.Position = script.Parent.Position - Vector3.new(0,0,0)
local tweenInfo = TweenInfo.new(7.5)
local tweenUp = TweenService:Create(script.Parent, tweenInfo, goal)
local tweenDown = TweenService:Create(script.Parent, tweenInfo, goal2)
script.Parent.ProximityPrompt.Triggered:Connect(function()
if loc == false then
script.Parent.Anchored = false
tweenUp:Play()
loc = true
script.Parent.Anchored = true
elseif loc == true then
script.Parent.Anchored = false
tweenDown:Play()
loc = false
script.Parent.Anchored = true
end
end)
I did both. Both worked. Maybe look into your prompt settings? Also, I would recommend putting the prompt in a button off to the side or inside an invisible part. Having it move with the gate can get difficult.