I'm working on a game, I ran into a problem in studio, the script works fine, it regenerates its health. When I publish the game and try it out, after the event fires it does everything else... except regenerate the health. I have been trying to fix this all day now and no luck. Any help? script:

script.Parent.Value.Value = script.Parent.HumanoidRootPart.Position
local health = script.Parent.Humanoid.Health


script.Parent.Humanoid.Died:connect(function()
	 
    script.Parent.HumanoidRootPart.ParticleEmitter.Rate = 20
    script.Parent.HumanoidRootPart.Size = Vector3.new(2,2,2)
    script.Parent.HumanoidRootPart.Transparency = 0.2
    wait(0.025)
    script.Parent.HumanoidRootPart.Size = Vector3.new(1.5,1.5,1.5)
    script.Parent.HumanoidRootPart.Transparency = 0.4
    wait(0.025)
    script.Parent.HumanoidRootPart.Size = Vector3.new(1,1,1)
    script.Parent.HumanoidRootPart.Transparency = 0.6
    script.Parent.HumanoidRootPart.ParticleEmitter.Rate = 0
    wait(0.025)
    script.Parent.HumanoidRootPart.Size = Vector3.new(0.5,0.5,0.5)
    script.Parent.HumanoidRootPart.Transparency = 0.8
    wait(0.025)
	script.Parent.HumanoidRootPart.Position = script.Parent.HumanoidRootPart.Position + Vector3.new(0,-20,0)
	wait(1)
	script.Parent.Humanoid.Health = 25
end)

local function OnEvent()
	
	script.Parent.HumanoidRootPart.Position = script.Parent.Value.Value
	script.Parent.Humanoid.Health = 25
	script.Parent.HumanoidRootPart.Size = Vector3.new(2.5,2.5,2.5)
	script.Parent.HumanoidRootPart.Transparency = 0
	wait(1)
	script.Parent.Humanoid.Health = 25
	
end

game.Workspace.Event.Event:Connect(OnEvent)

1 comment

0

What is the Bindable Event connected to? Are you trying to make the player's health 25 when they respawn?