any help is appreciated The error is ServerScriptService.TheWorldServer.TS:36: attempt to index nil with 'Name' and for some reason it causes the time stop to be infinite sometimes. The code is:
local music = game.Workspace.BackgroundMusic local model = game.ReplicatedStorage.Stand local InUse = game.ReplicatedStorage.InUse local bacon = {} local G = {} model.BaconTimeStop.OnServerEvent:Connect(function(player) local find = workspace:GetDescendants() if InUse.Value == false then InUse.Value = true local Sound = script.TSSound:Clone() Sound.Parent = workspace Sound:Play() music:Pause() wait(1.8) local TweenService = game:GetService("TweenService") local part = game.Lighting.ColorCorrection local goal = {} goal.Contrast = -2 local tweenInfo = TweenInfo.new(0.2) local tween = TweenService:Create(part, tweenInfo, goal) tween:Play() for i=1, #find do local That = find[i] if That:IsA("Part") or That:IsA("MeshPart") then if That.Anchored == false and That.Parent.Name ~= player.Name and That.Parent.Parent.Name ~= player.Name and That.Name ~= "Baseplate" and not That.Parent:IsA("Accessory") then That.Anchored = true table.insert(bacon, That) end end if That:IsA("ParticleEmitter") then That.TimeScale = 0 table.insert(G, That) end end wait(3) InUse.Value = false local TweenService = game:GetService("TweenService") local part = game.Lighting.ColorCorrection local goal = {} goal.Contrast = 0 local tweenInfo = TweenInfo.new(0.2) local tween = TweenService:Create(part, tweenInfo, goal) music:Resume() tween:Play() for i=1, #bacon do bacon[i].Anchored = false end table.clear(bacon) for i=1, #G do G[i].TimeScale = 1 end table.clear(G) end end)
~~~~~~~~~~~~~~~~~
Hello,
You are attempting to reference an object that does not exist. To solve this, we verify that all of our objects exist before referencing them:
for i=1, #find do local That = find[i] if That.Parent ==nil or That.Parent.Parent == nil then else if That:IsA("Part") or That:IsA("MeshPart") then if That.Anchored == false and That.Parent.Name ~= player.Name and That.Parent.Parent.Name ~= player.Name and That.Name ~= "Baseplate" and not That.Parent:IsA("Accessory") then That.Anchored = true table.insert(bacon, That) end end if That:IsA("ParticleEmitter") then That.TimeScale = 0 table.insert(G, That) end end end
Hope this helped!
Cheers,
Chase