Answered by
6 years ago Edited 6 years ago
Okay revising my answer now based on what you have told me.
So inorder to fix the client not seeing it as an animate objects you might have to get rid of that humanoid and make your own 'fake humanoid'
How I would do this is insert two NumberValue
that represents the MaxHealth and Health into the Generator.
So the MaxHealth
would be like 10 and then whenever someone attacks the generator the health keeps going down from there.
As for the regeneration of the Health
you would just use your while loop
and make the Health increase until it reaches max health.
You would have to connect that health to the status's health.
From there you can make it to where whenever the player attacks the Generator, the numbervalue changes, and when that number value changes the billboard gui changes as well.
If you want the player to be able to interact with a Billboard Gui it must be in the startergui.
If not you can just leave it inside of the generator.
Make sure the billboardgui is in the StarterGui folder as so: --Only if the player can edit it https://gyazo.com/8af0b7e47975d72f66f9f6a0681ea4b1
1) Inside of the player, you would put a localscript and inside of it make sure that everytime the generator's health changes the player recognizes it.
EX:
01 | local Plr = game.Players.LocalPlayer |
02 | repeat wait() until Plr.Character |
03 | local Char = Plr.Character |
04 | local Hum = Char:WaitForChild( 'Humanoid' ) |
06 | local GenHumanoid = Generator.Humanoid |
07 | local StatusGui = StarterGui.StatusGUI |
11 | GenHumanoid.HealthChanged:Connect( function () |
This will connect you locally to your generator's humanoid. The player can change the generator's health from the client by exploiting but it won't be updated to the server. That being said the change in health that player may see from doing so won't be the ACTUAL health.