This code is supposed to have a 20% chance of spawning in a part from server storage and then destroy it 29 seconds later. If it does not spawn the part it is then supposed to wait for 6 seconds before attempting to spawn the part again. I checked to make sure its name in server storage was "Part" and at this point, the only error I am receiving is to close "while true do" with an "end" which would crash my studio. Does anyone know the problem with the script?
while true do
Bodys = math.random (1,5)
if Bodys == 5 then
local model = game.ServerStorage.Part:Clone()
model.Parent=game.Workspace
wait(29)
model:Destroy()
else
wait(6)
end

3 comments
Is this a local script?
No, does it have to be?
No, I was just wondering incase you were trying to access ServerStorage from a local script, which you can't do.