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

How do I fix this cloning issue?

Asked by 9 years ago

I've been trying to clone a Gui from ServerStorage to the PlayerGui using a LocalScript for the past hour or so. The script seems fine; there's no output errors, and it should be working. I've done this script a little while back, but I'm not sure if a ROBLOX error is causing this, or if something about my script is a tad off.

local Player = game.Players.LocalPlayer
local ClickDetector = script.Parent.ClickDetector
local Gui = game.ServerStorage["Supplier Menu"]

ClickDetector.MouseClick:connect(function()
    local a = Gui:Clone()
    a.Parent = Player.PlayerGui
end)

Cheers in advance for any help.

1 answer

Log in to vote
0
Answered by
rexbit 707 Moderation Voter
9 years ago

Localscripts cannot access ServerStorage, use ReplicatedStorage instead.

local Player = game.Players.LocalPlayer
local ClickDetector = script.Parent.ClickDetector
local Gui = game.ReplicatedStorage["Supplier Menu"] -- Remember to place 'Supplier Menu` in ReplicatedStorage

ClickDetector.MouseClick:connect(function()
    local a = Gui:Clone()
    a.Parent = Player.PlayerGui
end)
0
Ah. Thank you. I didn't realise. I'd upvote if I could, but last time I was here I made the mistake of requesting scripts. BritishActuaI 44 — 9y
0
No Problem. Your question is no where near being referred to 'Requesting'. Also you could accept answer, it is found below the answer's profile icon, a check mark. rexbit 707 — 9y
0
There you go. BritishActuaI 44 — 9y
Ad

Answer this question