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

I have error in the shop for simulator?

Asked by 4 years ago
Edited 4 years ago

I'm trying to make a shop but when I try to buy things in the store this error comes


script.Parent.MouseButton1Click:connect(function() local RS = game:GetService("ReplicatedStorage") local item = RS:WaitForChild("Sword") local price = 0 -- Change Your Price Here local player = game.Players.LocalPlayer local stats = player:WaitForChild("leaderstats") if stats.Robux.Value == price then -- Change the Money to your Currency Name stats.Money.Value = stats.Money.Value - price local cloned = item:Clone() local cloned2 = item:Clone() cloned2.Parent = player.Backpack cloned.Parent = player.StarterGear end end)

in line 6

0
What error comes? farrizbb 465 — 4y
0
23:10:14.124 - Players.Dima_Games666.PlayerGui.SHOP.Frame.Frame.item1.Script:6: attempt to index local 'player' (a nil value) Dima_Games666 0 — 4y
0
i know "it's not local script" is the reason that player is nil. LocalPlayer is strictly client-only but i dont know how to fix it Dima_Games666 0 — 4y
0
Take all your code, place it in a LocalScript, at the same place as your current Script. You should not use Server Scripts in Guis Spjureeedd 385 — 4y
0
Techically s scripts only work for some gui elements like textbuttons SoftlockedUnderZero 668 — 4y

Answer this question