This is my code, I cant figure out why it doesnt work. I get no errors, and it has never worked.
-- Variables: local Player = game.Players.LocalPlayer local Character = Player.Character local Humanoid = Character:WaitForChild("Humanoid") local Clone = game.Lighting.Button:Clone() local Torso = Character:WaitForChild("HumanoidRootPart") -- Main code: Humanoid.Health.Changed:Connect(function(health) if health == Humanoid.Health then if Humanoid.Health < 1 then Clone.Parent = workspace Clone.Position = CFrame.new(Torso.Cframe) wait(1) Clone.Anchored = true end end end)
-- Variables: local Player = game:GetService("Players").LocalPlayer local Character = Player.Character local Humanoid = Character:WaitForChild("Humanoid") local Clone = game:GetService("Lightning").Button:Clone() local Torso = Character:WaitForChild("HumanoidRootPart") -- Main code: Humanoid.Died:Connect(function() Clone.Parent = workspace Clone.Position = CFrame.new(Torso.Cframe) wait(1) Clone.Anchored = true end)
if it doesnt work tell me
Try this if it does not work then tell me. Health is a property which cannot have events. You said Humanoid.Health.Changed but it needs to be Humanoid.HealthChanged
-- Variables: local Player = game.Players.LocalPlayer local Character = Player.Character local Humanoid = Character:WaitForChild("Humanoid") local Clone = game.Lighting.Button:Clone() local Torso = Character:WaitForChild("HumanoidRootPart") -- Main code: Humanoid.HealthChanged:Connect(function(health) if Humanoid.Health < 1 then Clone.Parent = workspace Clone.Position = CFrame.new(Torso.Cframe) wait(1) Clone.Anchored = true end end)