I am working on a movement gui that allows people to teleport. It works fine when the remote event is fired the first time, but when its fired another time, it stops turning visible, despite the workspace saying its visible. What is going on?
Local Script (In StarterCharacterScripts):
player = game.Players.LocalPlayer
character = player.Character or player.CharacterAdded:Wait()
humanoid = character:WaitForChild("Humanoid")
assignRoutes = game.ReplicatedStorage.Remotes.AssignRoutes
canPass1 = game.ReplicatedStorage.Remotes.CanPass1
canPass2 = game.ReplicatedStorage.Remotes.CanPass2
getWeapon = game.ReplicatedStorage.Remotes.GetWeapon
door1 = workspace.EmptyHouse.Door1.Closed
door2 = workspace.EmptyHouse.Door2.Closed
playerGui = player:WaitForChild("PlayerGui")
gui = playerGui:WaitForChild("BloxianPanel")
frame = gui:WaitForChild("EmptyHouseNavigation")
moveOn = frame:WaitForChild("MoveOn")
assignRoutes.OnClientEvent:Connect(function(path)
print("Route Received")
local route = path
local index = 1
local timer = 0
humanoid.WalkSpeed = 0
humanoid.JumpPower = 0
character:MoveTo(route[index].Position)
wait(15)
moveOn.Visible = true
moveOn.MouseButton1Click:Connect(function()
timer = 0
if index == #route then
if route[index] == workspace.EmptyHouse.BloxianTeleports.DoorTeleports.Door1 then
if not canPass1:InvokeServer() then
character:MoveTo(workspace.EmptyHouse.BloxianTeleports.JumpscareZone.Position)
humanoid.WalkSpeed = 16
humanoid.JumpPower = 50
getWeapon:FireServer()
moveOn.Visible = false
return
else
index = 0
end
end
if route[index] == workspace.EmptyHouse.BloxianTeleports.DoorTeleports.Door2 then
if not canPass2:InvokeServer() then
character:MoveTo(workspace.EmptyHouse.BloxianTeleports.JumpscareZone.Position)
humanoid.WalkSpeed = 16
humanoid.JumpPower = 50
getWeapon:FireServer()
moveOn.Visible = false
return
else
index = 0
end
end
end
index = index + 1
character:MoveTo(route[index].Position)
moveOn.Visible = false
wait(8)
moveOn.Visible = true
while true do
if moveOn.Visible == true then
wait(1)
timer = timer + 1
if timer == 8 then
index = 1
character:MoveTo(route[index].Position)
break
end
else
break
end
end
end)
end)

2 comments
you probably have a bug in your code that makes it so you need to reset
are you hiding to ui from sight by click the ui hid button. This might not be the case though.