I checked out this script from someone on this website 3 years ago but it doesn't seem to work:
local plr = game.Players.LocalPlayer; local stats = plr:WaitForChild("leaderstats");
stats.BodyTempering.Changed:connect(function(change) local hum = plr.Character:FindFirstChild("Humanoid"); hum.MaxHealth = change+1; --Change health hum.Health = change+1; end)
I have a leaderstat BodyTempering inside Localplayer.Player.Leaderstats and I'm trying to change the value of the MaxHealth and Health to BodyTempering+1 (Because it begins at 0). If anyone can help I would be very greatful. The script has no known errors and humanoid is working fine. BTW I also don't know where to place the script because I started a couple of weeks ago.
What you did is used LocalPlayer in a server script. Something that would work is this:
local Players = game:GetService("Players") Players.PlayerAdded:Connect(function(player) player.CharacterAdded:Connect(function(character) local leaderstats = Instance.new("Folder") leaderstats.Name = "leaderstats" leaderstats.Parent = player local playerHealth = Instance.new("IntValue") playerHealth.Name = "Health" playerHealth.Value = character:WaitForChild("Humanoid").Health playerHealth.Parent = leaderstats character:WaitForChild("Humanoid"):GetPropertyChangedSignal("Health"):Connect(function() playerHealth.Value = character:WaitForChild("Humanoid").Health end) end) end)
I think that this should work idk:
game.Players.PlayerAdded:connect(function(player) local leader = Instance.new("Folder", player) leader.Name = "leaderstats" local Health = Instance.new("IntValue", leader) Health.Name = "Health" Health.Value = game.Players.LocalPlayer.Humanoid.Health.Value end)