So... I added this local script into the starterGui so when a player touches a part, he will be shown a loadingGui and will be teleported to another place.
However... I recently noticed that this loadingGui only works for the first player who touches the part, and not for the others. Could somebody help me?
local debounce = false
function onTouched(hit)
if game.Players:FindFirstChild(hit.Parent.Name) and debounce == false then
debounce = true
local player = game.Players[hit.Parent.Name]
local rot = 0
player.PlayerGui.RevolutionGUI.ImageLabel.Visible = true
while true do
for i = 1,12 do
player.PlayerGui.RevolutionGUI.ImageLabel.Loading.Rotation = rot
rot = rot + 30
wait()
end
end
debounce = false
end
end
script:Destroy()
game.Workspace.RevolutionTP.Touched:connect(onTouched)
(The Rotation is to make a circle rotate on the loading screen.

1 comment
It's because you're using script:Destroy() at the end