I made a script that spawns a meteor with a function that’s hooked to it so that I can activate it whenever I want to. The only issue is, for some reason the Clone() function fires multiple times and I also get this weird error that I’ve never seen…
21:33:07.909 startScript re-entrancy has exceeded 3 - Server - Script:8
21:33:07.909 Stack Begin - Studio
21:33:07.909 Script 'Workspace.Meteor.Script', Line 8 - function summonMeteor - Studio - Script:8
21:33:07.909 Script 'Workspace.Meteor.Script', Line 23 - Studio - Script:23
21:33:07.909 Stack End - Studio
local Meteor = script.Parent
local InsideImpact = Meteor:WaitForChild("InsideImpact")
local OutsideImpact = InsideImpact:WaitForChild("OutsideImpact")
local region3Visual = Meteor:WaitForChild("region3Visual")
function summonMeteor()
local newMeteor = Meteor:Clone()
newMeteor.Parent = workspace
newMeteor.CFrame = CFrame.new(InsideImpact.CFrame.X, 0, InsideImpact.CFrame.Z) * CFrame.new(math.random(-360, 360), 250, math.random(-360, 360))
local tween = game:GetService("TweenService"):Create(newMeteor, TweenInfo.new(6, Enum.EasingStyle.Quint, Enum.EasingDirection.In, 0, false, 0), {
CFrame = InsideImpact.CFrame
})
tween:Play()
tween.Completed:Wait()
task.delay(5, game.Destroy, newMeteor)
end
summonMeteor()
21:44:27.421 Bombalooza auto-recovery file was created - Studio
21:44:29.500 a - Server - Script:4
21:44:29.501 a - Server - Script:4
21:44:29.501 a - Server - Script:4
21:44:29.502 a - Server - Script:4
21:44:29.502 startScript re-entrancy has exceeded 3 - Server - Script:6
21:44:29.502 Stack Begin - Studio
21:44:29.502 Script 'Workspace.Meteor.Script', Line 6 - function summonMeteor - Studio - Script:6
21:44:29.502 Script 'Workspace.Meteor.Script', Line 34 - Studio - Script:34
21:44:29.502 Stack End - Studio
21:44:29.503 b - Server - Script:7
21:44:29.503 c - Server - Script:13
21:44:29.503 d - Server - Script:21
21:44:29.503 b - Server - Script:7
21:44:29.503 c - Server - Script:13
21:44:29.503 d - Server - Script:21
21:44:29.504 b - Server - Script:7
21:44:29.504 c - Server - Script:13
21:44:29.504 d - Server - Script:21
21:44:29.960 Failed to load sound rbxassetid://13804622587: Unable to download sound data - Studio
21:44:30.719 NAAP disabled at runtime. - Server
21:44:35.446 e - Server - Script:28
21:44:35.447 f - Server - Script:31
21:44:35.447 e - Server - Script:28
21:44:35.448 f - Server - Script:31
21:44:35.448 e - Server - Script:28
21:44:35.448 f - Server - Script:31
local Meteor = script.Parent
function summonMeteor()
print("a")
local newMeteor = Meteor:Clone()
newMeteor.Parent = workspace
print("b")
local InsideImpact = newMeteor:WaitForChild("InsideImpact")
local OutsideImpact = InsideImpact:WaitForChild("OutsideImpact")
local region3Visual = newMeteor:WaitForChild("region3Visual")
local summoningSound = newMeteor:WaitForChild("summoningSound")
print("c")
newMeteor.CFrame = CFrame.new(InsideImpact.CFrame.X, 0, InsideImpact.CFrame.Z) * CFrame.new(math.random(-360, 360), 250, math.random(-360, 360))
local tween = game:GetService("TweenService"):Create(newMeteor, TweenInfo.new(6, Enum.EasingStyle.Quint, Enum.EasingDirection.In, 0, false, 0), {
CFrame = InsideImpact.CFrame
})
print("d")
summoningSound:Play()
tween:Play()
tween.Completed:Wait()
print("e")
task.delay(5, game.Destroy, newMeteor)
print("f")
end
summonMeteor()
Thanks so much for bringing that up, because I actually realized that since the script was in the meteor, and I was cloning the meteor, I guess that also cloned the script which made multiple script instances that did the same exact thing, causing the script to error before it kept going on infinitely.
Although, I am curious on how this happened as after cloning something with a script you typically need to disabled and then re-enable the script itself so that it can function. Do you happen to know if Roblox made some sort of update that made it so you don’t have to do this anymore?
I’m not entirely sure, but to my experience server scripts usually just run. My advice would be to have maybe a controller script (In server script service rather than having the scripts in the workspace), or maybe even use a module script if you see fit. Glad to see I could help!