I would like to detect when a player levels up and was wondering if someone could help me.
local value = game.Players.LocalPlayer.leaderstats.Level
value.Changed:Connect(function()
game.Players.LocalPlayer.leaderstats2.SP.Value=game.Players.LocalPlayer.leaderstats2.SP.Value+1
end)
I’ve tried fixing it many times and could not get it to work, could you help?
That script alone wouldn’t level a player’s level up because there isn’t another script that updates a player’s level, it only detects when the level changes.
--Put this in a script in "StarterPlayer" ---> "StarterPlayerScript"
local Remote = game.ReplicatedStorage:WaitForChild("RemoteEvent")
local value = game.Players.LocalPlayer.leaderstats.Level
value.Changed:Connect(function()
Remote:FireServer()
end)
--Put this in a script in the "ServerScriptService"
local Remote = game.ReplicatedStorage:WaitForChild("RemoteEvent")
Remote.OnServerEvent:Connect(function(Player)
Player.leaderstats2.SP.Value = Player.leaderstats2.SP.Value + 1
end)