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

Anything wrong with this script? It won't spawn in a GUI like it should be doing

function onClick(Player)
	screen = game.ServerStorage.Room1
	clone = screen:Clone()
	clone.Parent = Player.PlayerGui
	wait(1)
	clone:Destroy()
end

script.Parent.ClickDetector.MouseClick:Connect(onClick)

I don't get any errors whatsoever, and I was using it earlier and it worked perfectly fine. I have no idea what happened and why it no longer works. I even set everything back to the way it was when it was working and it still didn't work.

5 comments

0

edit your question to use codeblock so we can read it

0

is this script in a localscript? if so, localscrpts cant access serverstorage.

0

no, it is just a normal script

0

is the script disabled

0

no

1 answer

There are two things wrong with it. First thing is that the values like clone = screen:Clone() aren't working because there is no local. The 2nd thing is after 1 second it destroys the clone it just made. So It would take on the client for 1 second and then get removed. This is the fixed code.

function onClick(Player)
    local screen = game.ServerStorage.Room1
    local clone = screen:Clone()
    clone.Parent = Player.PlayerGui
end

script.Parent.ClickDetector.MouseClick:Connect(onClick)

Did my answer fix the issue? Please accept my answer it will give us both rep. Was my answer good? Upvote it as you wish, or well even downvote but that takes away rep :(

1 comment

0

nope, that didn't work.

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