Team Testing in Studio causes bugs

I have this issue when testing scripts in my game in multiplayer. Testing multiplayer in actual Roblox works perfectly fine, however when I try testing using Team Test, unexpected bugs happen that don’t happen any other time than when testing in Team Test specifically. I’ve had this issue in every one of my games so any help would be appreciated.

Can you be specific on what these bugs are?

yea sorry, basically the script just wont work as intended, for example, i have a script where you pick up an item, and if a player leaves while holding it the item drops. It works everywhere but Team Test. And this isnt the only example.

Well that’s still not enough detail however the characters you are controlling in team test are different from when in the actual game on the roblox website. For example their id is a negative number and for some things that would be a problem. Another is teleportation between places, it’s impossible in studio; it will always error even if it works in the actual roblox game.

thats just two examples, please send your script so I can give a better answer

game.ReplicatedStorage:WaitForChild("OnGrabRE").OnServerEvent:Connect(function(plr, target, dropping)
	if not target then return end

	if dropping then 
		-- Drop the object
		target:SetNetworkOwner(nil)

		for _, child in pairs(target:GetChildren()) do
			if child:IsA("BodyGyro") or child:IsA("BodyPosition") then
				child:Destroy()
			end
		end

		local lastPosition = target:FindFirstChild("LastPosition") 
		if not lastPosition then
			lastPosition = Instance.new("Vector3Value", target) 
			lastPosition.Name = "LastPosition"
		end
		lastPosition.Value = target.Position

	
		target.Position = lastPosition.Value 

		target.CanGrab.Value = ""  -- Reset the CanGrab property

	elseif target:FindFirstChild("CanGrab") and target.CanGrab.Value == "" then
		-- Grab the object
		local distance = (plr.Character.HumanoidRootPart.Position - target.Position).Magnitude
		if distance > 15 then return end  

		target.CanGrab.Value = plr.Name  -- Set the owner of the nugget

		if not target:FindFirstChild("BodyPosition") then
			local bp = Instance.new("BodyPosition", target)
			bp.D = 500 
			bp.MaxForce = Vector3.new(math.huge, math.huge, math.huge)
		end

		if not target:FindFirstChild("BodyGyro") then
			local bg = Instance.new("BodyGyro", target)
			bg.D = 500
			bg.MaxTorque = Vector3.new(math.huge, math.huge, math.huge)
		end

		target.Anchored = false

		target:SetNetworkOwner(plr)
	end
end)

strange, nothing in here should be such that it works in the game but not in team test

i mean, if it works in game 100% of the time, it doesn’t really matter. i was just wondering cuz it always happens