The Error says "attempt to index nil with 'leaderstats'" in the output. Anyone help me because i used both localscript and serverscript.
` local values = { 100, 200, 300, 400, 500, 600, 700, 800, 900, 1000 } script.Parent.MouseButton1Click:Connect(function(player) local hum = player.leaderstats local val = hum.Points if val.Value ~= values then else val.Value = val.Value - 100 local newcoil = game.ReplicatedFirst.GravityCoil:Clone() newcoil.Parent = player.Backpack end end)`
Problem
Solution
Code
--=== Services ===-- local Players = game:GetService("Players") --=== Variables ===-- local values = { 100, 200, 300, 400, 500, 600, 700, 800, 900, 1000 } local player = Players.LocalPlayer -- Declare it here --=== Connections & Main Loop ===-- script.Parent.MouseButton1Click:Connect(function() -- remove the argument here local hum = player.leaderstats local val = hum.Points if val.Value ~= values then else val.Value = val.Value - 100 local newcoil = game.ReplicatedFirst.GravityCoil:Clone() newcoil.Parent = player.Backpack end end)