All the remote events fire properly, but some clients just don’t receive them? (All events are fired independently, the prints checked out.)
The problem script:
local RepStore = game:GetService("ReplicatedStorage")
local UIenable = RepStore:WaitForChild("ActivateUI")
local MainModule = require(game.ReplicatedStorage.MainModule)
UIenable.OnClientEvent:Connect(function()
print("This actually fired")
game.Players.LocalPlayer.Character.LocalHandler.Disabled = false
script.Parent.Enabled = true
local StarterGui = game:GetService("StarterGui")
StarterGui:SetCoreGuiEnabled(Enum.CoreGuiType.Chat, false)
end)
The “This actually fired” print only showed up on some clients, and even that was inconsistent. Why is this happening.
The script
local RepStore = game:GetService("ReplicatedStorage")
local ServerStore = game:GetService("ServerStorage")
local MapFolder = ServerStore:WaitForChild("Maps")
local Status = RepStore:WaitForChild("Status")
local Teams = game:GetService("Teams")
local TeamList = Teams:GetTeams()
local Reward = 25
local GameMinutes = 4
local GameSeconds = 58
local Intermission = 25
local ActivateUI = RepStore:WaitForChild("ActivateUI")
local DeactivateUI = RepStore:WaitForChild("DeactivateUI")
local CloseUI = RepStore:WaitForChild("CloseUI")
local GiveGun = RepStore:WaitForChild("GiveGun")
local TakeGun = RepStore:WaitForChild("TakeGun")
local CurrentTeam = Teams.Blue
--Important Functions
local function TeamCheck(player)
if player.Neutral == true or player.Team == nil
then return nil
else
for i,team in pairs(TeamList) do
if player.Team == team
then return team
end
end
end
end
--The Loop
while true do
repeat
Status.Value = "WAITING FOR PLAYERS"
repeat wait(1) until game.Players.NumPlayers >= 2
Status.Value = "INTERMISSION"
for d = Intermission, 0, -1 do
Status.Value = "INTERMISSION "..d
wait(1)
end
plrs = {}
for x, player in pairs(game.Players:GetPlayers()) do
local ImIn = player.Character:WaitForChild("ImIn",.1)
if ImIn then
table.insert(plrs,player)
end
end
until #plrs >= 1 or #plrs == 1
wait(2)
local UseableMaps = MapFolder:GetChildren()
local ChoiceMap = UseableMaps[math.random(1,#UseableMaps)]
Status.Value = "ACTIVATING "..ChoiceMap.Name
local ClonedMap = ChoiceMap:Clone()
ClonedMap.Parent = workspace
local Spawns = ClonedMap:FindFirstChild("Spawns")
local AvailableSpawns = Spawns:GetChildren()
--Problem Area Start
for x, player in pairs(plrs) do
if player then
char = player.Character
EquippedGun = player.EquippedGun.Value
if char then
if CurrentTeam == Teams.Blue then
player.Team = CurrentTeam
CurrentTeam = Teams.Red
else
player.Team = CurrentTeam
CurrentTeam = Teams.Blue
end
CloseUI:FireClient(player)
ActivateUI:FireClient(player)
print("IfiredIt")
char:FindFirstChild("HumanoidRootPart").CFrame = AvailableSpawns[1].CFrame
table.remove(AvailableSpawns,1)
local shirt = TeamCheck(player):FindFirstChild("Shirt")
GiveGun:FireClient(player, EquippedGun)
print(EquippedGun)
shirt:Clone().Parent = player.Character
local GameTag = Instance.new("BoolValue")
GameTag.Name = "GameTag"
GameTag.Parent = char
print("givinggun")
else
if not player then
table.remove(plrs,x)
end
end
end
end
-- Problem Area End
Status.Value = "GO!"
wait(2)
repeat
for x, player in pairs(plrs) do
if player then
char = player.Character
if not char then
table.remove(plrs,x)
else
if char:FindFirstChild("GameTag") then
print(player.Name.." still is here.")
else
table.remove(plrs,x)
end
end
else
table.remove(plrs,x)
end
end
local playersB = Teams.Blue:GetPlayers()
local playersR = Teams.Red:GetPlayers()
if #playersB == 0 or #playersR == 0 then
Status.Value = "GAME OVER, 1 PLAYER REMAINS"
break
elseif #plrs == 0 then
Status.Value = "WOW, JUST WOW. GAME OVER"
break
end
if GameSeconds <= 0 then
GameMinutes = GameMinutes - 1
GameSeconds = 59
else
GameSeconds = GameSeconds - 1
end
if GameSeconds <= 9 then
Status.Value = tostring(GameMinutes)..":0"..tostring(GameSeconds)
else
Status.Value = tostring(GameMinutes)..":"..tostring(GameSeconds)
end
wait(1)
until GameMinutes <= 0 and GameSeconds <= 0
if game.ReplicatedStorage.BluScore.Value > game.ReplicatedStorage.RedScore.Value then
Status.Value = "BLUE WINS ".. game.ReplicatedStorage.BluScore.Value.."/"..game.ReplicatedStorage.RedScore.Value
elseif game.ReplicatedStorage.RedScore.Value > game.ReplicatedStorage.BluScore.Value then
Status.Value = "RED WINS ".. game.ReplicatedStorage.RedScore.Value.."/"..game.ReplicatedStorage.BluScore.Value
else
Status.Value = "GAME OVER"
end
game.ReplicatedStorage.BluScore.Value = 0
game.ReplicatedStorage.RedScore = 0
GameSeconds = 58
GameMinutes = 4
ClonedMap:destroy()
for x, player in pairs(game.Players:GetPlayers()) do
local ImIn = player.Character:WaitForChild("ImIn",.1)
if ImIn then
table.insert(plrs,player)
end
end
for x, player in pairs(plrs) do
if player then
char = player.Character
if char then
player.Team = Teams.Lobby
TakeGun:FireClient(player)
DeactivateUI:FireClient(player)
char.Humanoid.Health = 0
char = player.Character
print(player, char)
wait()
local ImIn = Instance.new("IntValue")
ImIn.Name = "ImIn"
ImIn.Parent = player.Character
else
if not player then
table.remove(plrs,x)
end
end
end
end
end
What’s supposed to happen (it works on one of the clients, randomly):
What happens for the other client (rarely for both):
(This is a repost, but I did a really bad job with the original, probably since I was cooked after a whole day of working on an update. Some things were added, so that it is more understandable.)