Basically I have a folder of Customer in the workspace. I try to teleport one of them to a certain position, but It doesn't work and they don't show up. Sometimes its just deletes all the brick parts inside them for some reason
local guiFolder = script.Parent.Gui
local timer = guiFolder.Timer
local jobPartsFolder = game.Workspace:WaitForChild("burgerJobParts")
local charSpawn = jobPartsFolder:WaitForChild("burgerCharacterSpawn")
local charPos = jobPartsFolder:WaitForChild("burgerCharacterPos")
jobRunning = script.Parent:WaitForChild("jobRunning")
local plr = game.Players.LocalPlayer;
local jobFolder = plr.PlayerGui:WaitForChild("Jobs")
local customerFolder = game.Workspace:WaitForChild("Customers")
local numberCustomers = 0
-- Gets the customers and puts them in an array
local customers = customerFolder:GetChildren()
for i = 1, #customers do
local customer = customers[i]
numberCustomers = numberCustomers + 1
end
-- Chooses random customer
local rn = Random.new ()
local num = rn:NextInteger ( 1, numberCustomers)
-- Enables Timer
timer.Enabled = true
timer.timerScript.Disabled = false
jobRunning.Value = true
-- Manages Timer
while(jobRunning.Value) do
if (customers[num]:FindFirstChild("Humanoid"):IsA("Humanoid")) then --// Same principles
customers[num]:MoveTo(charSpawn.CFrame.Position)
else
print(customers[num].Name.." doesn't have a Humanoid.")
end
num = rn:NextInteger ( 1, numberCustomers)
wait(10)
end
