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

Server Script works in studio but in not in game? Any help? Won't work with text button

Hello,

This is a script that is currently in a Textbutton within a surface Gui. FE is on but I don't think that would the issue. Even with FE off, this does not work when I upload it and test it. It only seems to work while in playing in studio.

script.Parent.MouseButton1Click:connect(function(Player)
script.Parent.Parent.Parent.Frame:Remove()
end)

Thanks,

Anthony

4 comments

1

Make sure this is a LocalScript, and that the SurfaceGui is in PlayerGui/PlayerGui. I swear me and someone else just answered a similar question like this..

0

MouseButton1Click has no parameters. Make sure this is a localscript inside the player

1

Next time accept someones answer instead of just deleting it, it helps their reputation and your reputation.

0

*instead of just deleting your question

1 answer

✓ Accepted answer

Player is undefined and basically not needed, and Remove() is deprecated. This also needs to be in a LocalScript and the SurfaceGui needs to be in the StarterGui.

script.Parent.MouseButton1Click:Connect(function()
script.Parent.Parent.Parent.Frame:Destroy() --Destroy instead of Remove
end)

Please accept my answer if this helped!

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