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

Why does my Closing script for my gui work only in studio mode not player mode?

Asked by 7 years ago

Why dos this script work in studio mode not player mode. I was assured before that it was because the script has a bug, but I cant find it. I'm new to scripting btw!

Next = script.Parent
Frame = Next.Parent

function onClicked(GUI)
    Frame:Remove()
end
script.Parent.MouseButton1Click:Connect(onClicked)
0
Are you using a Local Script? OldPalHappy 1477 — 7y

1 answer

Log in to vote
0
Answered by 7 years ago
Edited 7 years ago

This script should work, but what would happen is the script, next, and frame would all be deleted. Because you are Removing "Frame", which is the parent of Next and the script.

Next = script.Parent
Frame = Next.Parent

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

So I updated my answer because I noticed that :Connect was capitalized, so I made the C lower-cased. Functions, events, etc. are case sensitive (most of them) so be careful!

1
:Connect should be capitalized, because :connect is deprecated. block01352 57 — 7y
Ad

Answer this question