Advertisement
TheRealAaron

I added a pcall function

Jan 5th, 2025
102
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.29 KB | None | 0 0
  1. local Enemy = require(script.Enemy)
  2. local map = workspace.Grassland
  3. for i = 1, 3 do
  4.     local success, errorMessage = pcall(function()
  5.         Enemy.Spawn("Zombie", map)
  6.     end)
  7.     if not success then
  8.         warn("Error spawning enemy: " .. errorMessage)
  9.     end
  10.     task.wait(1)
  11. end
  12.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement