Cloning gui from startgui?
So i made an announcer gui which is now inside StarterGui, What i'm trying to achieve is when the player successfully captured the flag the gui will announce this : game.StarterGui.Announce.Frame.Txt.Text = "Fort Altipix 2.0, controlled by " ..name2.. ", is being captured by the " ..name.. "!" ------- ->>> But its not working..
See the rest of the script.
001 | bin = script.Parent.Base |
002 | owner = script.Parent.CurrentOwner |
003 | distance = script.Parent.CaptureDistance.Value |
004 | steps = script.Parent.StepsToBottom |
005 | maxsteps = steps.Value |
010 | neutral = script.Parent.NeutralColor.Value |
015 | script.Parent.FlagManager.Disabled = false |
019 | for i,v in pairs (game.Players:GetPlayers()) do |
020 | table.insert(players, v) |
023 | game.Players.PlayerAdded:connect( function (p) table.insert(players, p) end ) |
025 | function findTeamByColor(color) |
027 | for i,v in pairs (game.Teams:children()) do |
028 | if v.TeamColor = = color then |
036 | function moveFlag(team, name, name 2 ) |
037 | if (team ~ = owner.Value) and (owner.Value ~ = neutral) then |
038 | if steps.Value > 0 then |
039 | a.CFrame = a.CFrame-Vector 3. new( 0 , 7 /maxsteps, 0 ) |
040 | b.CFrame = b.CFrame-Vector 3. new( 0 , 7 /maxsteps, 0 ) |
041 | c.CFrame = c.CFrame-Vector 3. new( 0 , 7 /maxsteps, 0 ) |
042 | d.CFrame = c.CFrame-Vector 3. new( 0 , 7 /maxsteps, 0 ) |
043 | steps.Value = steps.Value- 1 |
044 | if steps.Value = = 0 then |
046 | defendingteam = owner.Value |
048 | game.StarterGui.Announce.Frame.Txt.Text = "Fort Altipix 2.0, controlled by " ..name 2.. ", is being captured by the " ..name.. "!" |
049 | game:service( "Debris" ):AddItem(m, 10 ) |
052 | elseif (team = = owner.Value) and (owner.Value ~ = neutral) then |
053 | if steps.Value < maxsteps then |
054 | a.CFrame = a.CFrame+Vector 3. new( 0 , 7 /maxsteps, 0 ) |
055 | b.CFrame = b.CFrame+Vector 3. new( 0 , 7 /maxsteps, 0 ) |
056 | c.CFrame = c.CFrame+Vector 3. new( 0 , 7 /maxsteps, 0 ) |
057 | d.CFrame = c.CFrame+Vector 3. new( 0 , 7 /maxsteps, 0 ) |
058 | steps.Value = steps.Value+ 1 |
059 | if steps.Value = = maxsteps then |
063 | elseif (team ~ = owner.Value) and (owner.Value = = neutral) then |
064 | if team = = defendingteam then |
065 | if steps.Value > 0 then |
066 | a.CFrame = a.CFrame-Vector 3. new( 0 , 7 /maxsteps, 0 ) |
067 | b.CFrame = b.CFrame-Vector 3. new( 0 , 7 /maxsteps, 0 ) |
068 | c.CFrame = c.CFrame-Vector 3. new( 0 , 7 /maxsteps, 0 ) |
069 | d.CFrame = d.CFrame-Vector 3. new( 0 , 7 /maxsteps, 0 ) |
070 | steps.Value = steps.Value- 1 |
071 | if steps.Value = = 0 then |
072 | game.StarterGui.Announce.Frame.Txt.Text = "Fort Altipix 2.0 has been recovered from the " ..findTeamByColor(attackingteam).. " by the " ..name.. "!" |
073 | game:service( "Debris" ):AddItem(m, 10 ) |
080 | a.CFrame = a.CFrame+Vector 3. new( 0 , 7 /maxsteps, 0 ) |
081 | b.CFrame = b.CFrame+Vector 3. new( 0 , 7 /maxsteps, 0 ) |
082 | c.CFrame = c.CFrame+Vector 3. new( 0 , 7 /maxsteps, 0 ) |
083 | d.CFrame = d.CFrame+Vector 3. new( 0 , 7 /maxsteps, 0 ) |
084 | steps.Value = steps.Value+ 1 |
085 | if steps.Value = = maxsteps then |
087 | game.StarterGui.Announce.Frame.Txt.Text = "Outpost Infinity has been captured by the " ..name.. " from the " ..findTeamByColor(defendingteam).. "!" |
089 | game.StarterGui.Announce.Frame.Txt.Text = "Outpost infinity has been claimed by the " ..name.. "." |
091 | game:service( "Debris" ):AddItem(m, 10 ) |
102 | for i,v in pairs (players) do |
103 | if v.Character ~ = nil then |
104 | torso = v.Character:findFirstChild( "Torso" ) |
106 | if (torso.Position-bin.Position).magnitude < = distance then |
107 | if v.TeamColor ~ = neutral then |
108 | moveFlag(v.TeamColor, findTeamByColor(v.TeamColor), findTeamByColor(owner.Value)) |