Search the Community
Showing results for tags 'spawner'.
-
Hello i am trying to create a spawner just a simple one and it seems to have a small error i dont understand. Any help would be greatly appreciated. here is my code Script.spawnObject = "" --entity "spawn object" Script.spawnTime= 1.0 --float "Spawn time" self.timer = 0 function Script:UpdateWorld() self.timer = self.timer + (Time:GetSpeed()/100) if(self.timer > self.spawnTime) then local newObject = self.spawnObject:Instance() newObject:SetPosition(self.entity:GetPosition {)} self.timer = 0 end end and the error i get says script error unexpected symbol near ')' line 9 that is the only error that it has came up with. thank you for any help
-
I found a tutorial for a decent script to make a monster spawner ,but I do not need it to run upon game start as it was shown in the tutorial. I'm pretty bad at scripting but i tried to have the spawner disabled at start and tried to start it upon enabling but I am jacking something up in the code somewhere and I lack the experience to find out where. If you can help me correct my mistake I would be thankful:) Script.Target = nil --Entity "character target" Script.SpawnRate = 5.5 --float "spawn rate" Script.MaxZombies = 5 --int Max zombs function Script:Start() self.enabled = false end function Script:Enable()--in if self.enabled == false then self.enable = true self.lastSpawnTime = 0 self.counter = 0 end end function Script:UpdatePhysics() if self.counter >= self.MaxZombies then return end if Time:GetCurrent() > self.lastSpawnTime + (self.SpawnRate * 1000) then self.counter = self.counter + 1 self.lastSpawnTime = Time:GetCurrent() --create a zombie and set location, speed, and target to the player local zombie = Prefab:Load("AddOns/Zombie Character Pack/zombie1.pfb") zombie.script:Start() zombie:SetPosition(self.entity:GetPosition()) zombie.script:Enable() --zombie.script.Speed = 2 zombie.script.Player = self.Target end end