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

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

Asked by
wswswff 39
2 years 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 2189 — 2y
0
where would I put this though wswswff 39 — 2y

1 answer

Log in to vote
0
Answered by
lamgogo 56
2 years 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