local h = script.Parent.Humanoid while true do h:MoveTo(workspace.DontClean1.Position) wait(5) h:MoveTo(workspace.DontClean2.Position) wait(5) end if h.Health then if h.Health == 0 then game.Lighting.SuperEvilKeycard:Clone().Parent = game.Players.LocalPlayer.Backpack script.Parent:Destroy() end end
The humanoid moves, but when it dies, nothing happens. There isn't any output errors, i dont know what's happening. as always, i would be happy to elaborate
As the post above me said, you've got a loop that won't let your script continue. Therefore, you're going to need to force the script to run two things at once. Scary, I know. This is when we can use the Spawn()
function, which you can read more about here.
local h = script.Parent.Humanoid function onDeath() if h.Health then if h.Health == 0 then game.Lighting.SuperEvilKeycard:Clone().Parent = game.Players.LocalPlayer.Backpack script.Parent:Destroy() end end end spawn(function(onDeath)) while true do h:MoveTo(workspace.DontClean1.Position) wait(5) h:MoveTo(workspace.DontClean2.Position) wait(5) end
If this helped you out, consider accepting this answer. If not, let me know and I'll be sure to help you out further.