I've been trying to make a script where where, every so often, a crystal will spawn in the bounds of the map. I have a while wait() loop in a script. The script is in ServerScriptService. The error is coming from the loop and says: "Requested Module is Required Recursively".
My code:
local Rate = script.resourceRate
local MaxSpawn = Vector3.new(218.44, 0.5, -227.733)
local MinSpawn = Vector3.new(-228.008, 0.5, 223.37)
print("Localled")
while wait(math.exp(Rate.Value))do
print("Making")
local Crystal = game.ServerStorage.Crystal:Clone()
Crystal.Parent = workspace
Crystal.CFrame = math.random(Vector3.new(218.44, 0.5, -227.733), Vector3.new(-228.008, 0.5, 223.37))
end
Anybody have an idea on how to fix this? It's never happened before.

13 comments
Btw, I tried another while wait() loop without wnything in it. Still gave me the same error.
Just don't do while wait() do. I honestly don't see why people do that. Do it like you should, while true do. And then have a wait() inside your loop
^^ while true do with a wait() and while wait() do is the same thing
Still didn't work... gave me the same error.
Well what line then?
Maybe your script is too messy. Maybe try a module script?
Even with the Module script it gave me the same error
The error is from the wait
Put a interger in the wait.. I dont how thats going to work but I hope it does
when i mean interger i mean number
Maybe use a variable in the script to hold the value instead of a Instance to hold the value
So you dont have to waste more time searching for the Instance that holds the cerain value.
Also File Space too