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

Literally just trying to make a gui clone into PlayerGui and then this happens, pls help?

Asked by 6 years ago
Edited 6 years ago

https://gyazo.com/7af5f08fb52279429053f5527ad0377e

local axe = "Draco Axe"
local price = 30
local currency = "Gems"

script.Parent.ClickDetector.MouseClick:Connect(function(plr)
    wait()
    local Gui = game.ServerStorage.limitedEditionGui
    Gui.Axe.Value = axe
    Gui.Price.Value = price
    Gui.Currency.Value = currency
    Gui.Parent = plr.PlayerGui
end)
0
Put the script you tried in your message. yHasteeD 1819 — 6y
0
done suphaninjap221 -9 — 6y
0
you're trying to clone a GUI from server storage. use replicated storage if you're dealing with client sided stuff. DinozCreates 1070 — 6y
0
ClickDetector allows Server Sided events. suphaninjap221 -9 — 6y
View all comments (3 more)
0
And no that didn't work, it returned the same error. suphaninjap221 -9 — 6y
0
i didnt say that was your only issue, just that you should not use server storage for GUI's. DinozCreates 1070 — 6y
0
uh, i've done it before and it worked perfectly. suphaninjap221 -9 — 5y

2 answers

Log in to vote
1
Answered by
yHasteeD 1819 Moderation Voter
6 years ago
Edited 6 years ago

Try to put the GUI in ReplicatedStorage. and on Click this not clone the gui. only set the parent. for this you need to clone. add :Clone() after limitedEditionGui:

    local Gui = game.ReplicatedStorage.limitedEditionGui:Clone() -- I changed the location to ReplicatedStorage.

here is fixed script:


-- ServerScript(Script) -- local axe = "Draco Axe" local price = 30 local currency = "Gems" script.Parent.ClickDetector.MouseClick:Connect(function(plr) wait() local Gui = game:GetService("ReplicatedStorage").limitedEditionGui:Clone() -- Location of the GUI / and changed the GUI to ReplicatedStorage. / Added :Clone() Gui.Axe.Value = axe Gui.Price.Value = price Gui.Currency.Value = currency Gui.Parent = plr:WaitForChild("PlayerGui") -- Added WaitForChild() end)

Use ServerScript(Script) for this.

This error only happens if you change the location of an item immediately after it is created. to solve this is just clone.

If I am wrong you can correct me in the comments i will edit the answer.

Wiki pages:

Clone

Hope it helped :)

Errors? tell-me on comments.

Ad
Log in to vote
0
Answered by 6 years ago
Edited 6 years ago
local axe = "Draco Axe"
local price = 30
local currency = "Gems"

script.Parent.ClickDetector.MouseClick:Connect(function(plr)

        wait()
        local GuiClone =                game:WaitForChild("ServerStorage"):FindFirstChild("limitedEditionGui"):Clone() --Changed

        Gui:WaitForChild("Axe").Value = axe
        Gui:WaitForChild("Price").Value = price
        Gui:WaitForChild("Currency").Value = currency
        Gui.Parent = game.StarterGui --Added

end)

U should use :Clone() if u are trying to put the Gui in Player's Gui.

Also

Gui:WaitForChild("Axe").Value = axe
Gui:WaitForChild("Price").Value = price
Gui:WaitForChild("Currency").Value = currency

U shouldnt try to use Guis to label the Name of the Axe, Price or Currency.

Use a TextLabel for the Name of the axe and TextButton for the price(30 Gems) instead so that when the Gui is cloned into the Player's Gui, it is already there and so u wont have to change anything.

Reason for TextButton is because u can just put a LocalScript, which is included in the Gui when its cloned, into the TextButton and when a player tries to buy the axe, he/she can just click the TextButton and buy it. Also, with TextButton, u can label the price of the axe as well.

IMPORTANT [EDIT] Also dude u can just put the Gui into StarterGui straight, so when the player spawns, u dont need to clone anything from ServerStorage and it will be in Player's Gui, just change the Value to TextLabel and TextButton.

I hope this helps!

If theres any error, comment below.

Answer this question