My Script works In Studios but Not Online for some reason? The Health loads up but you can't damage it at all. Works perfectly fine in Studios Please help. Script 1

local h = Instance.new("Humanoid")

h.Parent = script.Parent

local Human = script.Parent:WaitForChild("Humanoid")

while true do
	wait(0.01)	
	if script.Parent:FindFirstChild("Humanoid") == true then
	wait(2)	
	script.Parent:FindFirstChild("Humanoid").MaxHealth = 5000
	wait(2)
	script.Parent:FindFirstChild("Humanoid").Health = 5000
	end
end

Script 2

local Destroyed = script.Parent:FindFirstChild("Humanoid")
local sound = script.Parent:FindFirstChild("Boom")
local Human = script.Parent:WaitForChild("Humanoid")

while true do
	wait(0.01)
local Human = script.Parent:WaitForChild("Humanoid")	
	if Destroyed.Health == 0 then
		sound:Play()
		script.Parent:remove()
	end
end

Thank you.

4 comments

0

At what point does the script take damage from the humanoid?

0

When a Player uses a weapon on it.

0

Once a player gets it to 0 Health it is supposed to remove itself. But it is not working In Online mode for some reason, and i see no error in dev console