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

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

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)

1 comment

0

Are you using a Local Script?

1 answer

✓ Accepted answer

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 comment

1

:Connect should be capitalized, because :connect is deprecated.

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