Hi, i’ve been trying to fix this but i’m tired after hours and hours i’ve been scripting, i would like some help!
So it’s not changing the Exp, that’s the problem, there’s nothing in the console.
Server:
if Humanoid.Health > 0 then
if Humanoid.Health == Humanoid.MaxHealth then
Humanoid.Died:Connect(function()
game.ReplicatedStorage.AddPoints:FireClient(game:GetService("Players")[Tool.Parent.Name], Humanoid.Points.Value)
end)
end
if Humanoid.Health > 0 then
if Humanoid.Health == Humanoid.MaxHealth then
Humanoid.Died:Connect(function()
local Player = game:GetService("Players")[Tool.Parent.Name]
Player.leaderstats.Exp.Value += Humanoid.Points.Value
end)
end
end
That’s because you update it locally and not on the server.
That value won’t replicate to the server (the server doesn’t know if it was updated or not since it doesn’t replicate).
Do what the ones above me said: Do it on the server-side.
if Humanoid.Health > 0 then
if Humanoid.Health == Humanoid.MaxHealth then
Humanoid.Died:Connect(function()
game:GetService("Players"):FindFirstChild([Tool.Parent.Name]).leaderstats.Exp.Value += Humanoid.Points.Value
end)
end
Not sure if this will make it work but it’s worth a try.
When using FireClient, the first argument in the client call is automatically the player itself. No need to provide it if no needed. In your case, add another param for the player.
Plus, it’s always better to update stats on the server.
On a server script :
If you want to award the killed player -
game.Players.PlayerAdded:Connect(function(Player)
Player.CharacterAdded:Connect(function(Char)
Char:WaitForChild("Humanoid").Died:Connect(function)
--do stuff here
end)
end)
end)
If you want to reward the killer :
game.Players.PlayerAdded:Connect(function(Player)
Player.CharacterAdded:Connect(function(Char)
Char:WaitForChild("Humanoid").Died:Connect(function)
local tag = Char:WaitForChild("Humanoid"):findFirstChild("creator")
if tag ~= nil then
if tag.Value ~= nil then
local Leaderstats = tag.Value:findFirstChild("leaderstats")
if Leaderstats ~= nil then
Leaderstats.Kills.Value += 1
end
end
end
end)
end)
end)