Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

Local script help?

This script is in a LocalScript and when I click on a TextButton then Frame does not get removed. This script only works in Studio and not in the real game.

--//Variables
plr = game.Players.LocalPlayer
plrGui = plr.PlayerGui.Note
Frame = plrGui.Frame
Tb = Frame.Close

--//Script
Tb.MouseButton1Click:connect(function()
	Frame:Destroy()
end)


1 answer

✓ Accepted answer
--//Variables
plr = game.Players.LocalPlayer
repeat wait() until plr.Character -- makes sure everything loads first
plrGui = plr.PlayerGui.Note
Frame = plrGui.Frame
Tb = Frame.Close

--//Script
Tb.MouseButton1Click:connect(function()
    Frame:Destroy()
end)



The line i added at the annotation mark makes sure everything loads, it works in studio because it loads instantly but in server scripts load before actual server stuff so latency issues emerge. I added it so it waits till the server loads the character.

This discussion is preserved as it was. New answers, comments, and votes are closed.