Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

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

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

2 comments

0

Use :WaitForChild("respawn_time")

0

where would I put this though

1 answer

✓ Accepted answer

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

This discussion is preserved as it was. New answers, comments, and votes are closed.