Game breaking bug(Minigame)

How the “game breaking” bug work?
So basically when I test the minigames solo, everything basically works fine example below.
https://gyazo.com/4cb9637d66f1b3e1b271bd8192972e84
But as soon as I test the minigame with two players, The minigame starts acting up aka not working properly example below.
https://gyazo.com/67b4bfdb6c4e9cb1d9d98d517ca09568

Game code for tile frenzy:

local TileFrenzyMap = script.Parent.Parent.TileFrenzyMap

—//Services
local ReplicatedStorage = game:GetService(“ReplicatedStorage”)
local TweenService = game:GetService(“TweenService”)

—//Tween configuration
local Tweeninfo = TweenInfo.new(2,Enum.EasingStyle.Linear,Enum.EasingDirection.In,-1,false,0)

—//BindableEvent
local BindableEventFolder = ReplicatedStorage:WaitForChild(“BindableEventFolder”)
local TileFrenzyRemote = BindableEventFolder:WaitForChild(“TileFrenzyRemote”)

—//TileFrenzy Variables
local TileFrenzyChildren = TileFrenzyMap:GetChildren()

TileFrenzyRemote.Event:Connect(function()
TileFrenzyFunction()
end)

function TileFrenzyFunction()
while wait(1) do
local TileFrenzyPicker = TileFrenzyChildren[math.random(1, #TileFrenzyChildren)]
if TileFrenzyPicker:IsA(“Part”)then
– local TileTween = TweenService:Create(TileFrenzyPicker, Tweeninfo, {Position = Vector3.new(20, -10, 20)})
TileFrenzyPicker.Anchored = false
end
end
end

This game breaking bug has been holding me back a lot on my game and I need HELP!

1 Like

Is this in a Server Script or a Local Script?

1 Like

Yes, This is in a Server Script.

1 Like

So when is this event fired? Can I see that script?

1 Like

I see. You are firing the event once per player, so there are different threads running of function TileFrenzyFunction() You should fire it outside of the player iteration, after players have been teleported.

1 Like

Thats still in the player loop.

Put it outside the for loop, not the if statement. It will still fire for each player.

1 Like

Could that be the reason the minigame was buggy?

Try it. It should work properly

I’m still getting the same bug

do you happen to have discord, so you can probably help me with debugging?

yep, myaltaccountsthis#0507
so the tween doesnt play, correct? and that is intended?


Add me MarTailty#8101, I’ll discuss more over discord

When is the RemoteEvent fired? If both players fire the RemoteEvent the server would overwrite itself at the same time (it’d create two different threads), and could be an explanation of why it would seem glitchy.

Remote events can’t be used for Server <-> Server Communication, as I believe that is what the OP is willing to do.