Hello, I am trying to make a game and when I try it it says:
And this is the script for the MainEvent:
And the weight/LocalScript:
Hello, I am trying to make a game and when I try it it says:
And this is the script for the MainEvent:
And the weight/LocalScript:
LocalPlayer only exist on the client! Thats why you’re getting “attempt to index nil with leaderstats” (since the localPlayer is nil/doesn’t exist).
Luckily, this should be an easy fix since OnServerEvent passes the player who fired it!
script.AddStrength.OnServerEvent:Connect(function(Player)
local Strength = Player:WaitForChild("leaderstats").Strength
Strength.Value = Strength.Value + 1
end)
Note there may be typos but thats the general idea