Main problem: Script not working
Your script doesn't work because you set the value of the score to itself
1 | game.ReplicatedStorage.Score.Score.Value = game.ReplicatedStorage.Score.Score.Value |
I guess what you're trying to do is to set the value in the leaderstats
to what is in ReplicatedStorage
, so:
1 | game.Players.LocalPlayer.leaderstats.fightscore.Value = game.ReplicatedStorage.Score.Score.Value |
Secondary problem:
Inserting a 5-second wait()
is really inefficient. Instead, you could use :GetPropertyChangedSignal(string property)
, so:
1 | game.ReplicatedStorage.Score.Score:GetPropertyChangedSignal( "Value" ):Connect( function () |
Your fixed script would be:
1 | game.ReplicatedStorage.Score.Score:GetPropertyChangedSignal( "Value" ):Connect( function () |
2 | game.Players.LocalPlayer.leaderstats.fightscore.Value = game.ReplicatedStorage.Score.Score.Value |