Script works as intended then goes to sleep

Hello, I am making a speedrun mechanic for my game and whenever the player steps in the speedrun part box, a gui appears whether they would like to speedrun or not. It works just fine, however when they begin the speedrun, then click “exit” button, and then go back to speedrun, the gui doesn’t appear anymore. Here is my current code:

local requirementstage = 20
local text = "Would you like to speedrun the easy section?"

game.Players.PlayerAdded:Connect(function(plr)
	script.Parent.Touched:Connect(function(hit)
		if hit.Parent == plr.Character and plr.leaderstats.Stage.Value >= requirementstage then
			plr.PlayerGui.SpeedRun.SpeedRunFrame.SpeedRunConfirmText.Text = text
			plr.PlayerGui.SpeedRun.SpeedRunFrame.Visible = true
		end
	end)
end)
1 Like

Is this script a server-sided script? If so, this is the main reason why. The server changes it but the client doesn’t see it and if the exit is being run by a localscript the server doesn’t see it changed and doesn’t do anything.

Change this to a localscript. If you need help converting it into a localscript, I’ll be happy to help.

1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.