Hello. I am making a game, and in the game I have a team selection GUI which pops up when you join the game. After you select the team, the GUI is set to visible, because there are scripts inside which are needed.
Anyways, the problem I am having is that I have another GUI that I want to pop up to a player that has chosen that team.
Here is the example ;
I join the game. I Join The Noobs Team. The GUI which I selected "Noobs" team from has now been set to Visible = false .
Now I want the GUI in which the weapon selection options are. I have it Replicated Storage and in my script I try to :Clone() it then make the Parent of the GUI the PlayerGui .
Where have I gone wrong and how can I fix it?
(This is a script in which I used in another place which I made a year ago, and it works fine)
local p = game.Players.LocalPlayer
game.StarterGui.Start.Start.Army.MouseButton1Down:Connect(function()
if p.TeamColor.Name == "Maroon" then -- The team colour for Noobs is Maroon
p:WaitForChild("PlayerGui")
game.ReplicatedStorage.BaconArmy:Clone().Parent = p.PlayerGui
p.CharacterAdded:Connect(function(character)
game.ReplicatedStorage.BaconArmy:Clone().Parent = p.PlayerGui
end)
end
end)
I have this local script also which is in the Army button. Is there anything wrong with this that may be causing the clone not to show up on the clients screen?
local plr = game.Players.LocalPlayer --Easy way to refer to the client
local team = game.Teams.Noobs -- the team
local cam = game.Workspace.CurrentCamera -- not needed anymore but keep it ynot?
local cp = game.Workspace.CamPart -- i cba deleting
if plr:FindFirstChild("HasSelectedTeam") then --Check for the value
script.Parent.Parent.Parent:Destroy() -- if the value is there, then destroy the frame
end
function onButtonClicked()
plr.Character:BreakJoints() --Easy way to kill people
plr.Team = team --The client's team has now been set to the team we made a variable of before
Instance.new("BoolValue",plr).Name = "HasSelectedTeam"; --Insert value
script.Parent.Parent.Visibe = false --Instead of destroying it, it is set to invisible, because there are some valuable scripts inside
script.Parent.Parent.Parent.Options:Destroy() -- destroy the options, don't need them
end
script.Parent.MouseButton1Down:connect(onButtonClicked)

2 comments
Maybe fix the way you made the script?
What do you mean?