So, I recently enabled filtering and I dont know if it is related to the problem I am having but it seems to be that this script only works in studio and not in-game. Why is that?
button = script.Parent window = button.Parent function onClicked(GUI) window:remove() end script.Parent.MouseButton1Click:connect(onClicked)
The reason it works in Studio, and not the testing client is because you recently made your game filtering enabled. So you would have to make a RemoteEvent in order to get it to fire correctly. Here's a tutorial on how to use them: <http://wiki.roblox.com/index.php?title=Remote_Events_and_Functions >
Also here's a quick breakdown of what filtering enabled does to your game: http://wiki.roblox.com/index.php?title=FilteringEnabled
Here's what I would do: 1.Change your regular script in your GUI into a local script. 2.Make a RemoteEvent and put it in ReplicatedStorage 3.When using RemoteEvents, one script fires the event (In this case your local script) while another script listens for that firing and then runs whatever needs to be done. (The second script)
:remove() Is not an event, use :Destroy() I also have an easier way to call in the function, here is the script
button = script.Parent window = button.Parent script.Parent.MouseButton1Click:connect(function() window:Destroy() end)
So that is alot shorter, enjoy!
Just make the script a local script. Scripts don't work in PlayerGui.