Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

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

Asked by 6 years ago

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

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.. TheDeadlyPanther 2460 — 6y
0
MouseButton1Click has no parameters. Make sure this is a localscript inside the player lukeb50 631 — 6y
1
Next time accept someones answer instead of just deleting it, it helps their reputation and your reputation. PyccknnXakep 1225 — 6y
0
*instead of just deleting your question PyccknnXakep 1225 — 6y

1 answer

Log in to vote
1
Answered by 6 years ago
Edited 6 years ago

Player is undefined and basically not needed, and Remove() is deprecated. This also needs to be in a LocalScriptand 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!

Ad

Answer this question