So i have trying to do this script but i keep getting this error pls help me
script.Parent.MouseButton1Click:connect(function() local RS = game:GetService("ReplicatedStorage") local item = RS:WaitForChild("Gravity Coil") local price = 50 local player = game.Players.LocalPlayer local stats = player:WaitForChild("leaderstats") if stats.Points.Value == price then stats.Points.Value = stats.Points.Value - price local cloned = item:Clone() local cloned2 = item:Clone() cloned2.Parent = player.Backpack cloned.Parent = player.StarterGear end end)
Well, first off, it would be nice if you could put it in a code block because it would be way easier to read. Also, If you have your code written out like that and it's not a copy+paste error, I suggest taking a bit of time fixing it up so it's easier to read.
Since it's hard to read and you didn't give much information, I can't help very well. But to me, it looks like you may be trying to access the local player from a server script. If it's in a server script you can't use game.Players.LocalPlayer to get the local player. If it's something to do with the player, always use local scripts.