You can write your topic however you want, but you need to answer these questions:
-
What do you want to achieve? Keep it simple and clear!
I am trying to break the custom the loop in a custom function -
What is the issue? Include screenshots / videos if possible!
break statement must be in a loop -
What solutions have you tried so far? Did you look for solutions on the Developer Hub?
None
After that, you should include more details if you have any. Try to make your topic as descriptive as possible, so that it’s easier for people to help you!
local spawnPoints = workspace.SpawnPoints:GetChildren()
function SpawnFinger(finger,maxRandomness)
local randomNumber = math.random(0,maxRandomness)
if randomNumber == maxRandomness then
local randomSpawn = math.random(1,#spawnPoints)
local FingerClone = finger:Clone()
print(randomNumber)
FingerClone.Parent = workspace.Fingers
FingerClone.Handle.CFrame = spawnPoints[randomSpawn].PrimaryPart.CFrame + spawnPoints[randomSpawn].PrimaryPart.CFrame.UpVector
if FingerClone then
break
end
end
end
while true do
SpawnFinger(game.ReplicatedStorage.Finger,1)
wait(1)
end