Hi, I get an error with this script, I am confused how it happens:
Maximum event re-entrancy depth exceeded for ScriptContext.Error
Script timeout: exhausted allowed execution time
The script was also working fine earlier, I had changed it but I got the old script in history and it still seems to crash my game. Also the error is coming from
local tsunami = originalTsunami:Clone()
local tsunamiLadder = originalTsunamiLadder:Clone()
local function giveTsunami()
print("You received a Tsunami")
workspace.Sounds.Sound.Volume = 0
workspace.Sounds.Tsunami:Play()
-- Get the Tsunami and TsunamiLadder models from ReplicatedStorage
local originalTsunami = game:GetService("ReplicatedStorage"):FindFirstChild("Tsunami")
local originalTsunamiLadder = game:GetService("ReplicatedStorage"):FindFirstChild("TsunamiLadder")
if not originalTsunami or not originalTsunamiLadder then
print("Could not find Tsunami or TsunamiLadder model in ReplicatedStorage")
return
end
-- Clone the models
local tsunami = originalTsunami:Clone()
local tsunamiLadder = originalTsunamiLadder:Clone()
-- Parent the cloned models to workspace
tsunami.Parent = workspace
tsunamiLadder.Parent = workspace
-- Create the Tween for the Tsunami's movement
local tweenInfo = TweenInfo.new(
60, -- Duration
Enum.EasingStyle.Linear, -- EasingStyle
Enum.EasingDirection.Out, -- EasingDirection
0, -- RepeatCount
false, -- Reverses
0 -- DelayTime
)
local tweenGoal = {Position = tsunami.Position + Vector3.new(0, 0, 450)}
local tween = TweenService:Create(tsunami, tweenInfo, tweenGoal)
-- Start the Tween
tween:Play()
-- Wait for 60 seconds then remove the Tsunami and the ladder
wait(60)
workspace.Sounds.Sound.Volume = 0.5
workspace.Sounds.Tsunami:Stop()
tsunami:Remove()
tsunamiLadder:Remove()
end