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..

9 comments
FE IS OFF.
Why are your objects in Lighting. ROBLOX in NO WAY supports Lighting as storage. Switch to ReplicatedStorage
It doesn't matter where I am holding them, I just put them in lighting for neatness sake, I am taking a clone of them anyway, they are not there so they can run.
Still. Using Lighting as storage is not supported by ROBLOX. Using Lighting as storage is NOT neat. The only objects that should go in Lighting are skyboxes and PostEffects. Scripts aren't post effects.
Alright, but do you have any other idea on why it won't work.
In your server code, you are destroying the script, which will disconnect OnServerEvent and the FireServer method won't work.
hey! I added all of your recommendations and it still doesnt work.
Why are you using a remote event with FE off it defeats the purpose.
Dont use remotevents without FE on theres no point and it can cost more bandwith. I suggest you turn FE on if your game is going to live due to exploiers.