The gif shows what the problem is. Player1 is clicking join team, and I’m cloning a playerCard from replicatedStorage to parent it to the frame, however Player2 doesn’t see that Player1’s card is on the team. Why is this happening and how can I fix it?
Gif of what I mean:
https://gyazo.com/3e730f3122ea748edc8ccb0d697ebd2d
Here’s my EventHandler Script for that:
local teamService = game:GetService("Teams")
local replicatedStorage = game:GetService("ReplicatedStorage")
local playerTeamedPraetorianEvent = game.ReplicatedStorage.Events.playerTeamedPraetorianEvent
playerTeamedPraetorianEvent.OnServerEvent:Connect(function(Player)
print(Player.Name .. " playerTeamedPraetorianEvent")
local joinTeamFrame = Player.PlayerGui.Main.JoinTeamFrame
Player.Team = teamService.Praetorian
Player.TeamColor = BrickColor.new("Mulberry")
print(Player.Name .. " has joined the Praetorian team")
local playerCard = replicatedStorage.Assets.purpleTemplate:Clone()
playerCard.Parent = joinTeamFrame.PurpleTeam.ScrollingFrame
wait(2)
joinTeamFrame.joinSixth.Visible = false
joinTeamFrame.joinPraetorian.Visible = false
Player:LoadCharacter()
game.ReplicatedStorage.Values.status.Value = ""
end)
local playerTeamedSixthEvent = game.ReplicatedStorage.Events.playerTeamedSixthEvent
playerTeamedSixthEvent.OnServerEvent:Connect(function(Player)
print(Player.Name)
local joinTeamFrame = Player.PlayerGui.Main.JoinTeamFrame
Player.Team = teamService.Sixth
Player.TeamColor = BrickColor.new("Maroon")
print(Player.Name .. " has joined the Sixth team")
local playerCard = replicatedStorage.Assets.redTemplate:Clone()
playerCard.Parent = joinTeamFrame.RedTeam.ScrollingFrame
wait(2)
joinTeamFrame.joinSixth.Visible = false
joinTeamFrame.joinPraetorian.Visible = false
Player:LoadCharacter()
game.ReplicatedStorage.Values.status.Value = ""
end)
Here is the client script for pressing the button which fires the Remove event in the event handler script (above)
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local button = script.Parent
local teams = game:GetService("Teams")
local playerTeamedPraetorianEvent = game.ReplicatedStorage.Events.playerTeamedPraetorianEvent
button.MouseButton1Down:Connect(function()
print("clicked mouse button 1 down")
local Player = script.Parent.Parent.Parent.Parent.Parent
playerTeamedPraetorianEvent:FireServer()
script.Parent.Visible = false
script.Parent.Parent.joinSixth.Visible = false
end)
Thanks