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

How can I make the gui clone from a surfacegui?

I can't seem to make the gui clone to the playergui. Once I click on it, nothing happens and it doesn't show up on the PlayerGui

player = script.Parent.Parent.Parent.Parent.Parent.Parent.Players
local hand = game:GetService("ReplicatedStorage")
function MouseClick()
	hand:WaitForChild("Sound")
	player:WaitForChild("PlayerGui")
	hand:Clone()
	
	end
script.Parent.MouseButton1Click:connect(MouseClick)

1 answer

Currently, this code just clones ReplicatedStorage, which isn't what you're trying to do.

Firstly,

I don't believe your file path to the player is correct, if you remove one of the Parent and .Player then I think this'd be right (don't quote me on that as I'm doing a bit of guess work from your code).

Line one would now be changed to: player = script.Parent.Parent.Parent.Parent.Parent

You should be cloning the name of the item in ReplicatedStorage (I believe this is the item you've called sound, so I'll stick to that)

So on line 6, you'd want to have hand.Sound:Clone()to start with.

However, once you'd cloned this item, you've not told it where to clone to! So what needs to happen is you need to sent the Parent of this newly cloned Gui.

We can do this by changing Line 6 again; we'd now have hand.Sound:Clone().Parent = player.PlayerGui

The full script

Here's an exact copy of what your code should look like:

player = script.Parent.Parent.Parent.Parent.Parent
local hand = game:GetService("ReplicatedStorage")
function MouseClick()
    hand:WaitForChild("Sound")
    player:WaitForChild("PlayerGui")
    hand.Sound:Clone().Parent = player.PlayerGui
    end
script.Parent.MouseButton1Click:connect(MouseClick)

1 comment

0

Well I tried this , but it didn't seem to work. :c

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