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

Shop GUI i created only works perfectly fine in studio but doesn't work when i play the actual game?

Asked by 8 years ago
01local player = game.Players.LocalPlayer
02local currency = player:WaitForChild('leaderstats').Coins
03local amount = 200
04local tool = game.ServerStorage:WaitForChild('LinkedSword')
05local indextext = script.Parent.Text
06script.Parent.MouseButton1Click:connect(function()
07    if currency.Value >= amount and not player.Backpack:FindFirstChild('LinkedSword') or player.Character:FindFirstChild('LinkedSword') then
08        currency.Value = currency.Value - amount       
09        local newtool = tool:Clone()
10        newtool.Parent = player.Backpack
11        script.Parent.TextColor3 = Color3.fromRGB(11, 199, 4)
12        script.Parent.Text = 'Purchase succesful!'
13        wait(2)
14        script.Parent.TextColor3 = Color3.fromRGB(27, 42, 53)
15        script.Parent.Text = indextext
View all 39 lines...

I don't get why it doesn't work in an actual server. Anyone know why?

1 answer

Log in to vote
0
Answered by 8 years ago

I'm guessing this is a local script? Just a guess, but use Lighting or ReplicatedStorage instead of ServerStorage for your sword. Also, IS it "Clone" or "clone" -- I'm really sleepy right now so I'm not very sure

0
It's both, although Clone is preferred. SwardGames 325 — 8y
Ad

Answer this question