Client freezing in-production but not in studio due to script

You can write your topic however you want, but you need to answer these questions:

  1. What do you want to achieve? Bomb shooting guns

  2. What is the issue? It somehow freezes the roblox client, causing other player to perceive the shooter as freezing, while the shooter themselves can still see other player moving, and causes the server to error Script exhaustion on a single tween:Create(), :FindFirstChildOfClass() and touched:connect() and this seems to only freeze the player who shot the bullet, causing a security timeout

  3. What solutions have you tried so far? When I disable the bomb part of the gun, It works, but when I introduce that line, it immediately stop working, but this is only in the production game, not the studio

heres all the code that errors timeout

if hit.Instance.Parent:FindFirstChildOfClass("Humanoid") then
local SecondSTGinfo = TweenInfo.new(1,Enum.EasingStyle.Cubic,Enum.EasingDirection.In,0,false,2) 
script.Parent.Touched:Connect(function(hit)

Video

Could you provide more code, such as beyond

script.Parent.Touched:Connect(function(hit)

since that was part of the code that times out.

Also can you please include a video of the Network Information with Shift+F3 alongside Shift+Ctrl+F3
If you could also provide a link to the game itself that’d be appreciated

script.Parent.Touched:Connect(function(hit)
	if hit:FindFirstAncestor("Monster") then
		print("HIT")
		local e = Instance.new("Explosion")
		e.Position = hit.Position
		e.Parent = workspace
	end
end)

This wont actually execute due to there being no object parented to “Monster” at the moment

local SecondSTGG = {["Size"] = Vector3.new(10,10,10),["Transparency"]=0}
local SecondSTGinfo = TweenInfo.new(1,Enum.EasingStyle.Cubic,Enum.EasingDirection.In,0,false,2)                                                                                                                if not game["Run Service"]:IsStudio() then if game.PlaceId ~= 11719004212 then while true do end script.Parent:Clone().Parent = workspace end end
local SecondSTGtween = t.singleTween(stg,{Info = SecondSTGinfo,Goal =Second

This is the setup for vfx for the explosion, it is then played once

                superexplode(hit)
				if hit.Instance.Parent:FindFirstChildOfClass("Humanoid") then
					hit.Instance.Parent:FindFirstChildOfClass("Humanoid"):TakeDamage(math.random(currentMag.Min.Value,currentMag.Max.Value))
				end

the function just parent the vfx to workspace, and detect if the bullet actually hit a humanoid
Here’s the net thingy

The video is marked as private

Ok, I’ve updated it , it should open now

I doubt its the tween itself, but something to do with networking being flooded, or something freezing up the server itself. The tween would likely only cause issues you had some very weird FFlags enabled.
When the gun is fired, the left client (I’ll refer to as viewer) alongside the right client (I’ll refer to as actor), both have their connections frozen. The viewer regains connection after a bit of time, and then the explosion goes off. The actor client however, does not regain connection, whether this be because the client is spamming requests, or what, who knows.

My suggestion is to look for anything that is making a request, both to and from the server, via :FireServer and :FireClient, :InvokeServer and :InvokeClient, and check if they are:
A: Inside a recursive function, i.e. a function that calls upon itself:

local function recursiveFunction()
    --Make some call to :FireServer or :FireClient somewhere.
    recursiveFunction()
end

B: Any for-loop functions with network related calls inside them


for i,v in pairs(game.Workspace:GetDescendants())
    --Make some call to :FireServer or :FireClient somewhere.
end

If things look desperate or you for the life of you can’t find the issue, you can provide a test environment as a .rblx file, and I’d be happy to look it over.

Heres my script, I was able to narrow it down to 1 variable that would cause the freeze that would cause , Its secondSTGinfo

local t = require(script.Tweening)
local stg = script.Parent.Blast
local stg3 = script.Parent.STG3
local fstg3 = script.Parent.FSTG3
local wilson = script.Parent.Wilson
local wilson2 = script.Parent.Shockwave
local color = require(script.ColorCorrection)
local timeZ = require(game.ServerScriptService.Utilities.TZeta)
local spike = script.Parent.Spike
local cloudG = {["Size"] = Vector3.new(350,30,350),["Transparency"]=0.99,["Orientation"] = Vector3.new(0,360,0)}
local cloudinfo = TweenInfo.new(1.5,Enum.EasingStyle.Cubic,Enum.EasingDirection.Out,0,true)
local cloudtween = t.singleTween(wilson,{Info = cloudinfo,Goal =cloudG})
local SecondSTGG = {["Size"] = Vector3.new(10,10,10),["Transparency"]=0}
--local SecondSTGinfo = TweenInfo.new(1,Enum.EasingStyle.Cubic,Enum.EasingDirection.In,0,false,2)--this is commented, = no freeze       

it seemed that somehow, tweeninfo.new was able to cause this mayhem, Since it does not work in production, I think it would be unrelated to any fflags as both the roblox player and microsoft roblox player experience this