Hello! I am making a game like arsenal were the player character is destroyed and once they click the button it loads the character, but i have run into some issues. The character is only loading for 1 player and not the other players.
Local Script:
local event = game.ReplicatedStorage:WaitForChild("Events").LoadCharacter
local player = game.Players.LocalPlayer
script.Parent.MouseButton1Click:Connect(function()
if #player.StarterGear:GetChildren() > 0 then
event:FireServer(player)
script.Parent.Parent.Parent.Parent:Destroy()
game.StarterGui:SetCoreGuiEnabled(Enum.CoreGuiType.All, true)
else
script.Parent.Text = "Select Weapon!"
task.wait(1)
script.Parent.Text = "Deploy"
end
end)
Server Script:
game.Players.PlayerAdded:Connect(function(player)
player.CharacterAdded:Connect(function(char)
char:Destroy()
end)
end)
game.ReplicatedStorage.Events.LoadCharacter.OnServerEvent:Connect(function(player)
player:LoadCharacter()
local teams = game.Teams:GetTeams()
local randomTeam = teams[math.random(1, #teams)]
player.Team = randomTeam
end)
any help is appreciated!