The health dont change
Easy repro: put this script in ServerScriptService.
while true do
for _,player in pairs(game.Players:GetPlayers()) do
local character = player.Character
if (character) then
local humanoid = character:WaitForChild("Humanoid")
humanoid.BreakJointsOnDeath = false
print(humanoid.Health)
end
end
wait(.5)
end
Please never do anything like this in actual production. Honestly that code hurts to look at. Regardless I can’t reproduce your issue:
What you’re probably doing is changing the health from the client which has no effect on the server, because if it did that’d be a huge security flaw.
That’s odd, I’ve done it about 50 times and haven’t been able to reproduce it, do you have any other scripts that could be resetting the health to 100?
Hm, then I’m not sure, perhaps it could be a plugin, but I doubt it, I suppose to be safe you can test with all plugins disabled. If not maybe it’s a bug? But I can’t seem to reproduce it at all so I don’t really know if I can help you at all. Maybe someone else can reproduce it.
I honestly don’t know then, sorry I couldn’t help more. I opened up a new baseplate as well to test identically and haven’t been able to reproduce it. It may sound odd, but the only difference I can really make out is that I’m using r15 with no package, just default block limbs and default head. It wouldn’t make any sense, but maybe that’s causing this somehow?
After about 30 resets with the block r15 as the StarterCharacter, it’s safe to say it was my R15 Davy Bazooka package causing the issue. Please report this in bugs as I can’t i’m not high enough rank
I wish I could, but I can’t use bugs either. You can try dming bug-support directly and they might list it in bugs, that’s how I got a post moved there once. If you follow the format for a bug report in a direct message to bug-support they might move it over. It is odd that a mesh is causing that issue though.
Instead of having the loop run once per 0.1 seconds just have it run whenever a new player’s character is loaded/respawned, I’ve just tested this in studio and it is working.
local players = game:GetService("Players")
players.PlayerAdded:Connect(function(plr)
plr.CharacterAdded:Connect(function(char)
for _, player in pairs(players:GetPlayers()) do
local character = player.Character
local humanoid = character:WaitForChild("Humanoid")
humanoid.BreakJointsOnDeath = false
end
end)
end)
If anyone else reading this comes across the same problem (and I’ve experienced this exact problem in other games) you should create your own respawn system and a bindable event for the reset button.
Script inside ServerScriptService
local resetEvent = game:GetService("ReplicatedStorage"):WaitForChild("ResetEvent")
local runService = game:GetService("RunService")
local players = game:GetService("Players")
players.CharacterAutoLoads = false -- turn autoloads off, since custom respawn
resetEvent.OnServerEvent:Connect(function(player)
local startTick = tick()
local respawnTime = math.pi -- enter custom respawn time here
local character = player.Character
if (character) then
local humanoid = character:WaitForChild("Humanoid")
humanoid.BreakJointsOnDeath = false
humanoid:TakeDamage(humanoid.MaxHealth)
while (tick() - startTick < respawnTime) do -- gives more accurate respawn times
runService.Stepped:Wait()
end
player:LoadCharacter()
end
end)
local function OnCharacterAdded(character)
print("character added!")
end
local function onPlayerAdded(player)
player.CharacterAdded:Connect(OnCharacterAdded)
player:LoadCharacter()
end
players.PlayerAdded:Connect(onPlayerAdded)
Localscript inside StarterCharacterScripts
local resetEvent = game:GetService("ReplicatedStorage"):WaitForChild("ResetEvent")
local resetBindable = Instance.new("BindableEvent")
resetBindable.Event:Connect(function()
resetEvent:FireServer()
end)
-- This will remove the current behavior for when the reset button
-- is pressed and just fire resetBindable instead.
game:GetService("StarterGui"):SetCore("ResetButtonCallback", resetBindable)