this was solved in the scriptinghelpers discord
I'm making a spawn that will update the player's "Stage" stat, but it does nothing.
I even tried using prints to check was was going on, and both outputted 1, which meant the stat was changed to 1, and the stage number was 1, but the leaderboard stat value never changed.
--Server Script--
wait(0.1) local function setSpawn(partTouching) if game.Players:GetPlayerFromCharacter(partTouching.Parent) then --Check if is a player local player = game.Players:GetPlayerFromCharacter(partTouching.Parent) local character = player.Character local stageNum = script.Parent.StageNum.Value local stage = player.leaderstats.Stage.Value print(stageNum) if stage < stageNum and player.Character.Humanoid.Health ~= 0.001 then stage = stage + 1 print(stage) player.RespawnLocation = script.Parent else character.HumanoidRootPart.Position = script.Parent.Destination.Position end end end script.Parent.Touched:Connect(setSpawn)
--Output--
1 --(print(stageNum), which is intended) 1 --(It says 1 here, but the stat never changed, I even checked the intValue itself and it never changed.)
Is there any reason why this is happening?