I have a series of scripts that when you test in studio, they work perfectly.. but when you try it in the real game, they don't work at all.
this is the first script
game.Players.PlayerAdded:Connect(function() print(1) wait() if game.Workspace.game.CanCollide == true and game.Workspace.PlayerCount.Players.Value < 1 then print(2) game.ReplicatedStorage.Remotes.five1:FireAllClients("Waiting for FIVE PLAYERS.") elseif game.Workspace.PlayerCount.Players.Value > 0 and game.Workspace.game.CanCollide == true then print(3) game.ReplicatedStorage.Remotes.five1:FireAllClients("Enough Players.") end end)
if fires this one
wait() player = game.Players.LocalPlayer print(1) game.ReplicatedStorage.Remotes.five1.OnClientEvent:Connect(function(TextArg) print(11) script.Parent.TextButton.Text = TextArg if game.Workspace.PlayerCount.Players.Value < 1 then script.Parent.Visible = true print(2) elseif game.Workspace.PlayerCount.Players.Value > 0 then wait(10) local player = game.Players.LocalPlayer script.Parent.Visible = false end wait(2) local a = game.Lighting.this:Clone() local b = game.Lighting.LocalScript:Clone() a.Parent = game:GetService("ServerScriptService") b.Parent = game.Players.LocalPlayer.PlayerGui.pods.ann a.Disabled = false b.Disabled = false game.ReplicatedStorage.Remotes.run:FireServer() end)
those work perfectly in both studio and the real game. but where it goes wrong is when that script is supposed to fire this one..
game.ReplicatedStorage.Remotes.run.OnServerEvent:Connect(function(qnay) wait(5) print("thiss") if game.Workspace.game.CanCollide == true then print("this") game.ReplicatedStorage.Remotes.ann:FireAllClients("Welcome to the annual HUNGER GAMES.") wait(10) game.ReplicatedStorage.Remotes.ann:FireAllClients("If you don't know how to play, read the description!") wait(10) game.ReplicatedStorage.Remotes.ann:FireAllClients("Selecting random arena...") wait(10) game.ReplicatedStorage.Remotes.ann:FireAllClients("Arena selected. Prepare to enter. May the odds be ever in your favor.") game.Workspace.game.CanCollide = false local tools = game.Lighting.tools:Clone() tools.Parent = game.Workspace local foods = game.Lighting.test:Clone() foods.Parent = game.Workspace script:Destroy() end end)
in studio it happens, in the real game it doesnt. any ideas why? FE IS OFF. It gets stuck on the 'Waiting for FIVE PLAYERS' I used other numbers instead of five for testing..