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

How do I make a humanoid respawn at a certain amount of time?

Asked by 6 years ago
Edited 6 years ago

>The script is to respawn a model but I think a humanoid is a model so I used this script. So I want this script to respawn a humanoid every minute but it only multiplies the humanoid. I thought it was going to work at first but then when the humanoid respawned, 2 appeared and then after that there were 4 and then 8 and so on, so I couldn't use the script. I don't know how to fix the problem and also the message that appears when the humanoid respawns makes the game lag.

Edit: Ok Thanks, but these are the changes I made and it still won't work.

Here's the script:

local regenTime = 180 -- 3 minutes local messageTime = 2.5

local model = script.Parent local message = Instance.new("Message")

if model ~= workspace then message.Text = "" .. model.Name

local backup = game.Workspace:WaitForChild('model')


while true do 
    wait(regenTime) 


    model:Destroy()


    model = backup:clone() 
    model.Parent = game.Workspace 
    model:makeJoints()
end
0
clone and makeJoints are deprecated switch to Clone and MakeJoints. User#19524 175 — 6y

1 answer

Log in to vote
0
Answered by 6 years ago

It's because you are cloning eachother

'local backup = model:clone()' and 'model = backup:clone()', 

maybe try:

local backup = game.Workspace:WaitForChild('model')
Ad

Answer this question