I want a gate (Model) that slides into one position on click and slides back into its original position on second click. almost everything works well except for when i change the ".01" to anything different, it doesn't open nor close anymore.
script.Parent.ClickDetector.MouseClick:connect(function()
local state = script.Parent.Parent.State
if state.Value == false then
state.Value = true
local Gate = script.Parent.Parent.Gate
for i = 0, .7, .01 do
Gate:SetPrimaryPartCFrame(Gate:GetPrimaryPartCFrame() * CFrame.new(0,0,-i))
end
else
state.Value = false
local Gate = script.Parent.Parent.Gate
for i = 0, .7, .01 do
Gate:SetPrimaryPartCFrame(Gate:GetPrimaryPartCFrame() * CFrame.new(0,0,i))
end
end
end)

2 comments
Would you mind telling us what you are changing it to?
I'm changing it to "1"