Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

How do I make a model not take damage?

Asked by 5 years ago
Edited 5 years ago

I don't know how to make a model not take damage because I don't want others to kill the model. I tried adding a invisible wall but you still could kill it and i tried this script which also didn't work:

while true do
local npc = game.Workspace.NathanToh2 
local respawnPos = (-227.7, -12.9, 23.7) 
if npc.Health == 0 then
npc.Position = Vector3.new(respawnPos)
end
end

1 answer

Log in to vote
0
Answered by
OnaKat 444 Moderation Voter
5 years ago
game.Players.PlayerAdded:Connect(function(plr)
    plr.CharacterAdded:Connect(function(npc)
        if npc.Name == "Nathantoh2" then
            repeat wait() until npc.Humanoid.Health == 0
            local respawnPos = Vector3.new(-227.7, -12.9, 23.7)
            plr.CharacterAdded:Connect(function()
                repeat wait() until plr.Character ~= nil
                local char = plr.Character
                char:MoveTo(respawnPos)
            end)
        end
    end)
end)
Ad

Answer this question