Dummy Humanoid.Health Problem

Did you just change your character Humanoid.Health?
not on other players or other stuffs just yourself

It will update on the server too if you do it on yourself.

2 Likes

Use LocalScript instead of Script.

1 Like

Let make this clear

  1. I test this thing on Dummy.
  2. When i change Health of dummy in client Early , its doesn’t effect to server.
  3. and i change Health value on Dummy use this Script.
local a = script.Parent:WaitForChild("Humanoid")
a.MaxHealth = 30000
a.Health = a.MaxHealth

local b = Instance.new("IntValue")
b.Parent = script.Parent
b.Name = "maxhp"
b.Value = a.MaxHealth


local c = Instance.new("IntValue")
c.Parent = script.Parent
c.Name = "Hp"
c.Value = b.Value

and then when i Change Health value of dummy, use Properties on cllient its, changed health of Dummy in server too.

1 Like

Try to put the testing script into a LocalScript. For setting the health, you can use a normal Script file for that.

2 Likes

Health must be changed by the server in order to replicate.
You shouldn’t modify the humanoid’s health at all on the client-side.

2 Likes

btw im not modifed Humanoid.Health, on the client side. i just put normal script inside the dummy

Why, if i try change Value of Humanoid.Health at Client, its Changed Value on server too

That is incorrect.
Anyways, since you’re using a script and not a localscript, I don’t see your issue.

2 Likes
  1. when i change new dummy all things is work perfcely, when i change Health value of dummy, use Properties on client its, changed only health on client side only.
  2. but if, i try same thing to old dummy, its change health value on client side and server side
  1. when i change new dummy all things is work perfcely, when i change Health value of dummy, use Properties on client its, changed only health on client side only.

Then use a server-script instead.

  1. but if, i try same thing to old dummy, its change health value on client side and server side

If it’s a server-script, yes.

No it won’t update your health, however you can forcefully set your own state to dead.

Then use a server-script instead.

Im use server script to both of dummy

If it’s a server-script, yes.

i just changed Humanoid.Health on client side only, but why its effect to server side ?

i just changed Humanoid.Health on client side only, but why its effect to server side ?

If it’s affecting the server, you did not change it via a localscript because it does not replicate.

bro, just try this dummy bro, and then try changed health of dummy in client side
https://www.roblox.com/library/7084621433/Testdummy

You will be able to see the change but not the server.

bro,i swear its change the server too. How i know ? cause i trying use this script too.

> script.Parent.Humanoid.HealthChanged:Connect(function(health)
> 	if health == 0 then
> 	print("Die")
> 	end
> end)

and its printed in server side bro.

HealthChanged is a client-sided-only event.

1 Like

bro, i fix my problem I don’t know if this is related, but its work, when i change my dummy
HumanoidRootPart.Anchored = false, and then i change my dummy health in client side, its change server side too. but when i change HumanoidRootPart.Anchored = True, and then i change my dummy health, its only effect on client side, not server side.

It does NOT replicate to the server.
You are watching it change health and fall to the ground on the client, not the server, which is the difference here.

1 Like

You are watching it change health and fall to the ground on the client, not the server

Yo bro watch till 1:09 i change it to server side right ?
and how about the output ? i used same code here

First of all, you are using HealthChanged on the server-side, which won’t work:
https://developer.roblox.com/en-us/api-reference/event/Humanoid/HealthChanged

Secondly, the reason why this happens is because the player instance (you) have network ownership over the test dummy (including every part inside, of course).
More about NetworkOwnership: Network Ownership | Roblox Creator Documentation

For actual players, the server will be the network owner over their character.

If you want to avoid this behavior, you can have a look at this:
https://developer.roblox.com/en-us/api-reference/function/BasePart/SetNetworkOwner

2 Likes