Hello
I have a script for minigames that teleports back and lowers the player count in the minigame.
math.randomseed(tick()) local inProg = false function onTouch(hit) if hit.Parent:FindFirstChild("Humanoid") then if inProg == false then inProg = true wait() local ccord = math.random(-922, -898) local bcord = math.random(-3166, -3125) hit.Parent.Torso.CFrame = CFrame.new(ccord, 90, bcord) _G.numberOfPlayers = _G.numberOfPlayers - 1 _G.playersInGame = _G.playersInGame + 1 script.Parent.inGame.Value = script.Parent.inGame.Value - 1 print(script.Parent.inGame.Value) local player = game.Players:GetPlayerFromCharacter(hit.Parent) local backp = player.Backpack backp.isntOut.Value = false inProg = false end return end end game.Workspace:WaitForChild("SpinnerGroup").Spinner.Touched:connect(onTouch)
I think the problem is that "SpinnerGroup" from the bottom of the script teleports in and out of the workspace, but I have no idea how to fix this. Also there is no error.
Thanks.