|
| 10 Apr 2015 09:05 PM |
local spawns = curmap:FindFirstChild("Spawns"):GetChildren() local randomspawn = math.random(1, #spawns) local newzombie = zombie:Clone() zombie.Parent = workspace zombie:MakeJoints() zombie:MoveTo(spawns[randomspawn.Position])
21:04:11.750 - ServerScriptService.SpawnZombie:29: attempt to index local 'randomspawn' (a number value)
How do I fix this?
|
|
|
| Report Abuse |
|
|
|
| 10 Apr 2015 09:12 PM |
| local randomspawn = spawns[math.random(1, #spawns)] |
|
|
| Report Abuse |
|
|
| |
|
|
| 10 Apr 2015 09:12 PM |
| zombie:MoveTo(randomspawn.Position) |
|
|
| Report Abuse |
|
|
|
| 10 Apr 2015 09:14 PM |
Ok another question
function spawnfunc() for i = 60, 0, -5 do wait(5) local spawns = curmap:FindFirstChild("Spawns"):GetChildren() local randomspawn = math.random(1, #spawns) local newzombie = zombie:Clone() zombie.Parent = workspace zombie:MakeJoints() zombie:MoveTo(spawns[randomspawn].Position) end end
This is moving the current zombie BACK to its position, and not making another one |
|
|
| Report Abuse |
|
|
|
| 10 Apr 2015 09:18 PM |
function spawnfunc() for i = 60, 0, -5 do wait(5) local spawns = curmap:FindFirstChild("Spawns"):GetChildren() local randomspawn = spawns[math.random(1, #spawns)] local newzombie = zombie:Clone() zombie.Parent = workspace zombie:MakeJoints() zombie:MoveTo(randomspawn.Position) end end |
|
|
| Report Abuse |
|
|
|
| 10 Apr 2015 09:19 PM |
| There isn't a different between that and mine..? |
|
|
| Report Abuse |
|
|
|
| 10 Apr 2015 09:23 PM |
b
function spawnfunc() for i = 60, 0, -5 do wait(5) local spawns = curmap:FindFirstChild("Spawns"):GetChildren() local randomspawn = math.random(1, #spawns) local newzombie = zombie:Clone() zombie.Parent = workspace zombie:MakeJoints() zombie:MoveTo(spawns[randomspawn].Position) end end
|
|
|
| Report Abuse |
|
|
|
| 10 Apr 2015 09:24 PM |
| Actually there was a huge difference, look at it carefully. |
|
|
| Report Abuse |
|
|
|
| 10 Apr 2015 09:26 PM |
| His still won't create a new one. So.... |
|
|
| Report Abuse |
|
|
| |
|
| |
|
|
| 10 Apr 2015 09:39 PM |
| There was two differences. Are you calling the function lol? |
|
|
| Report Abuse |
|
|
|
| 10 Apr 2015 09:39 PM |
local status = game.ServerScriptService.Main.Value local zombie = game.ServerStorage.Zombie local event = game.ReplicatedStorage.SpawnSequence
event.Event:connect(function(...) local tuple = (...) if tuple == ("Spawn") then local map = game.Workspace.CurrentMap for _, v in pairs(map:GetChildren()) do curmap = v end
function timerfunc() for i = 60, 0, -1 do wait(1) status.Value = i end end
function spawnfunc() for i = 60, 0, -5 do wait(5) local spawns = curmap:FindFirstChild("Spawns"):GetChildren() local randomspawn = spawns[math.random(1, #spawns)] local newzombie = zombie:Clone() zombie.Parent = workspace zombie:MakeJoints() zombie:MoveTo(randomspawn.Position) end end
local timercor = coroutine.create(timerfunc) local spawncor = coroutine.create(spawnfunc)
for i = 10, 0, -1 do wait(1) status.Value = i.." seconds until Wave 1" end
coroutine.resume(timercor) coroutine.resume(spawncor)
repeat wait() until coroutine.status(timercor) == "dead" and coroutine.status(spawncor) == "dead"
for i = 10, 0, -1 do wait(1) status.Value = i.." seconds until Wave 2" end
coroutine.resume(timercor) coroutine.resume(spawncor)
repeat wait() until coroutine.status(timercor) == "dead" and coroutine.status(spawncor) == "dead" |
|
|
| Report Abuse |
|
|
| |
|
|
| 11 Apr 2015 11:43 AM |
| b again. why is this not working..?! |
|
|
| Report Abuse |
|
|
| |
|