All the scripts in startergui keeps repeating after resetting your character. How do I make a script only execute once? All the scripts are localscripts and they use events.
Here’s an example of a script that bugs out:
local RandomDoor = math.random(1,5)
local ReplicatedStorage = game:GetService("ReplicatedStorage")
if RandomDoor == 1 then
ReplicatedStorage.Events.one:FireServer()
end
if RandomDoor == 2 then
ReplicatedStorage.Events.two:FireServer()
end
if RandomDoor == 3 then
ReplicatedStorage.Events.three:FireServer()
end
if RandomDoor == 4 then
ReplicatedStorage.Events.four:FireServer()
end
if RandomDoor == 5 then
ReplicatedStorage.Events.five:FireServer()
end
print("The first secret door is "..RandomDoor)
print("hello there")
local TPUI = game.StarterGui.TPTesting.Frame.SecretDoor
TPUI.Text = "The secret door is "..RandomDoor
yes, that would be an easier way. Disable the script so it is not parented to nil, but actually just disabled. You can find disabling in the properties tab. Click on your script and there it will be.
To put this in a script write script.Disabled = true. Hope I could help