You can write your topic however you want, but you need to answer these questions:
- What do you want to achieve? Keep it simple and clear!
Hey guys, so, I am basically making a hockey league stat system, where I have a GUI that is able to detect who is on what team. If a player is teamed something specific, their name will be added to a UIGrid with stuff inside of them. I’ve got the part. After that, if I press their name, I will be able to add their name to a separate list, where everybody in the game can see who has a goal/assist/save. But, when I try to add their name to that list, it clones multiple times, in fact, based on the amount of players are in that server.
- What is the issue? Include screenshots / videos if possible!
https://gyazo.com/b6e8b76df7bdf2c0bedf4f333ec79eb8
- What solutions have you tried so far? Did you look for solutions on the Developer Hub?
I tried to look through DevForum, and couldn’t find anybody with a similar problem. I tried initially using the Server to disperse everybody’s UI via the Server, but I came to realize that was a problem. So, instead of using the server, I instead only use the server to tell all of my local people to clone this specific tab from the Replicated Storage, and slap it in the UI.
After that, you should include more details if you have any. Try to make your topic as descriptive as possible, so that it’s easier for people to help you!
Located within a button. All hierarchy is correct. No errors.
local button = script.Parent
local playerName = script.Parent.Parent
local playerList = playerName.Parent.Parent.Parent.StatSheet.Frame.Players.PlayerDisplay
local addPlayer2 = game.ReplicatedStorage.AddPlayer2
local updateGUI2 = game.ReplicatedStorage.UpdateGUI2
local player = game.Players.LocalPlayer
local playerToClone2 = game.ReplicatedStorage.Player2
button.MouseButton1Click:Connect(function(player)
local playerExists = findPlayer(playerName.Name)
if playerExists == false then
updateGUI2:FireServer(playerName.Name)
end
end)
updateGUI2.OnClientEvent:Connect(function(playerName)
local GUI = player.PlayerGui.StatSheet.Frame.Players.PlayerDisplay
local playerClone = playerToClone2:Clone()
playerClone.Parent = GUI
playerClone.Name = playerName
playerClone.Text = playerName
end)
function findPlayer(playerName)
for i,v in pairs(playerList:GetChildren()) do
if playerName == v.Name then
return v
end
end
return false
end
Located within ServerScriptService:
UpdateGUI2.OnServerEvent:Connect(function(player, playerName)
UpdateGUI2:FireAllClients(playerName)
end)
Let me know if anybody sees anything wrong with it. Like I said, everything works fine except for that.