Ad
Log in to vote
0

anyone can help me with a respawn script for a zombie?

Asked by 19 days ago
local time = script.Parent.Parent.respawn_time.Value
while true do
        wait(time)
        local robo=script.Parent:clone()
    robo.Parent = game.Workspace
    robo.HumanoidRootPart.Position = script.Parent.RoboPosition.Position
    robo.Humanoid.WalkSpeed = robo.Parent.WalkSpeed.Value
    robo.Humanoid.MaxHealth = robo.Parent.Health.Value

        robo.Script:Destroy()
end

everything looks good I dont knoe why. when i run it it says in the output "Workspace.Robos.Robo.RespawnScript:2: attempt to index nil with 'respawn_time'" even thought it is right

0
Use :WaitForChild("respawn_time") T3_MasterGamer 845 — 19d
0
where would I put this though wswswff 2 — 19d

1 answer

Log in to vote
0
Answered by
lamgogo 36
19 days ago

in line 1 use this

local time = script.Parent.Parent:WaitForChild("respawn_time").Value

if that still doesnt work

repeat wait() until script.Parent.Parent.respawn_time
local time = script.Parent.Parent.respawn_time.Value

in case both of them doesnt work,u placed the respawn_time value at another place not script.Parent.Parent

Ad

Answer this question