For some context up, the move of gate is working fine and i will use tween service later
The problem is on the cooldown but i don't know whats wrong, can someone anaylse whats wrong?
local system = button.Parent
local gate = system.Gate.Gate
local cooldown = system.Cooldown
button.Touched:Connect(function(hit)
local humanoid = hit.Parent:FindFirstChild("Humanoid")
if humanoid then
if cooldown.Value <= 0 then
cooldown.Value = 60
local x = gate.Position.X
local y = 6.689
local z = gate.Position.Z
gate.Position = Vector3.new(x,y,z)
print("succesful!")
end
end
while true do
if cooldown.Value ~= 0 then
task.wait(1)
print(cooldown.Value)
cooldown.Value = cooldown.Value - 1
else
local x = gate.Position.X
local y = 15
local z = gate.Position.Z
gate.Position = Vector3.new(x,y,z)
break
end
end
end)```
** You are now Level 3! **