This isn't my whole script but its the part that doesnt work
01 | game.Players.PlayerAdded:Connect( function (Player) |
02 | Player.CharacterAdded:Connect( function (Character) |
03 | local stats = Player:WaitForChild( "leaderstats" ) |
04 | local power = stats:WaitForChild( "Strength" ) |
05 |
06 | local damage = power* 1 |
07 |
08 |
09 | local slash_damage = power* 1 |
10 | local lunge_damage = power* 1.5 |
So your problem is just simple client/server boundary stuff. The server can't access the client, and the client can't access the server. So for this script you want to put it a local script. Here is an example on how I would modify it to make it work.
1 | -- LocalScript |
2 | local player = game:GetService( "Players" ).LocalPlayer |
3 | local stats = player:WaitForChild( "leaderstats" ) |
4 | local power = stats:WaitForChild( "Strength" ) |
5 | local damage = power* 1 |
6 | local slash_damage = power* 1 |
7 | local lunge_damage = power* 1.5 |