Curosity
|
  |
| Joined: 18 Aug 2010 |
| Total Posts: 1085 |
|
|
| 30 Mar 2015 02:51 PM |
This is the code for a flag I have. Whenever someone on the red team touches it, it turns red. That works fine, but this won't work.
while true do wait() if script.Parent.BrickColor == BrickColor.new("Bright red") then game.StarterGui.TEST.Part.Text = "Point 1 captured by raiders!" end end
Please help. I need it to say it to everyone in the server, thats why I didnt put it as a local script. |
|
|
| Report Abuse |
|
|
Curosity
|
  |
| Joined: 18 Aug 2010 |
| Total Posts: 1085 |
|
|
| 30 Mar 2015 02:52 PM |
| Or i mean thats why I didnt refer to a player's playergui. |
|
|
| Report Abuse |
|
|
Klink45
|
  |
| Joined: 06 Jun 2011 |
| Total Posts: 26054 |
|
|
| 30 Mar 2015 02:52 PM |
| Check to see if the flag's brickcolor has changed, then add the if statement after that. |
|
|
| Report Abuse |
|
|
lokkut
|
  |
| Joined: 18 Mar 2009 |
| Total Posts: 1794 |
|
|
| 30 Mar 2015 02:52 PM |
game.StarterGui.TEST.Part.Text = "Point 1 captured by raiders!"
loop through all palyers and change their gui individually
unless there's a new easier way and i'm being terribly inefficeint |
|
|
| Report Abuse |
|
|
|
| 30 Mar 2015 02:53 PM |
== “Bright red”
also changing the starter gui won’t work
Youll want to change everyones playerguis with a for loop |
|
|
| Report Abuse |
|
|
Curosity
|
  |
| Joined: 18 Aug 2010 |
| Total Posts: 1085 |
|
|
| 30 Mar 2015 02:54 PM |
| Aren't I checking if the brickcolor is red in the if statement? I'm really bad at scripting. |
|
|
| Report Abuse |
|
|
lokkut
|
  |
| Joined: 18 Mar 2009 |
| Total Posts: 1794 |
|
|
| 30 Mar 2015 02:54 PM |
== “Bright red”
that won't work
if BrickColor.new("Really red") ~= "Really red" then print("hi") end
prints hi |
|
|
| Report Abuse |
|
|
Curosity
|
  |
| Joined: 18 Aug 2010 |
| Total Posts: 1085 |
|
|
| 30 Mar 2015 02:56 PM |
| Okay, so im doing lol's way, Now it is printing hi, but it isnt changing the gui. How do I look through every player's gui? Once again, I suck at scripting ;-; |
|
|
| Report Abuse |
|
|
| |
|
Curosity
|
  |
| Joined: 18 Aug 2010 |
| Total Posts: 1085 |
|
| |
|
Klink45
|
  |
| Joined: 06 Jun 2011 |
| Total Posts: 26054 |
|
|
| 30 Mar 2015 03:00 PM |
Try this
local Players = game.Players:GetChildren
for i,v in pairs (Players) do --code end |
|
|
| Report Abuse |
|
|
lokkut
|
  |
| Joined: 18 Mar 2009 |
| Total Posts: 1794 |
|
|
| 30 Mar 2015 03:01 PM |
| local Players = game.Players:GetChildren() |
|
|
| Report Abuse |
|
|
|
| 30 Mar 2015 03:01 PM |
for _, p in pairs(game.Players:GetPlayers()) do pg = p.PlayerGui pg.TEST.Part.Text = “Point 1 captured by raiders" end |
|
|
| Report Abuse |
|
|
Curosity
|
  |
| Joined: 18 Aug 2010 |
| Total Posts: 1085 |
|
|
| 30 Mar 2015 03:09 PM |
| Klink's made an error, and the one above me made it so the text was always "Point 1 was captured by raiders" |
|
|
| Report Abuse |
|
|
|
| 30 Mar 2015 03:12 PM |
| @Above thats what he wanted me to do lol |
|
|
| Report Abuse |
|
|
Curosity
|
  |
| Joined: 18 Aug 2010 |
| Total Posts: 1085 |
|
|
| 30 Mar 2015 03:14 PM |
| No, I want the text to only be "point 1 captured by raiders" when the flag is red. I said that >;L |
|
|
| Report Abuse |
|
|
|
| 30 Mar 2015 03:15 PM |
| Exactly, thats what i did. |
|
|
| Report Abuse |
|
|
|
| 30 Mar 2015 03:17 PM |
while true do wait() if script.Parent.BrickColor == BrickColor.new("Bright red") then for _, p in pairs(game.Players:GetPlayers()) do pg = p.PlayerGui pg.TEST.Part.Text = “Point 1 captured by raiders” end end end
U obviously have to put it in the loop dude
|
|
|
| Report Abuse |
|
|
Klink45
|
  |
| Joined: 06 Jun 2011 |
| Total Posts: 26054 |
|
|
| 30 Mar 2015 03:17 PM |
Try this instead sorry
local Players = game.Players:GetChildren()
for i,v in pairs (Players) do --code end |
|
|
| Report Abuse |
|
|
lokkut
|
  |
| Joined: 18 Mar 2009 |
| Total Posts: 1794 |
|
|
| 30 Mar 2015 03:18 PM |
local Players = game.Players:GetPlayers()
for i = 1, #Players do local n = Players[i].PlayerGui:findFirstChild("TEST") if n then n.Part.Text = "Point 1 captured by raiders!" end end
function changegui(visible) for i = 1, #Players do local n = Players[i].PlayerGui:findFirstChild("TEST") if n then n.Part.Text = "Point 1 captured by raiders!" n.Part.Visible = visible end end end
script.Parent.Changed:connect(function() if script.Parent.BrickColor = BrickColor.new("Bright red") then changegui(true) else changegui(false) end end) |
|
|
| Report Abuse |
|
|
Curosity
|
  |
| Joined: 18 Aug 2010 |
| Total Posts: 1085 |
|
|
| 30 Mar 2015 03:21 PM |
| YAS, THE EGG MAN'S SCRIPT WORKED! SUCCESS >:D |
|
|
| Report Abuse |
|
|
| |
|
lokkut
|
  |
| Joined: 18 Mar 2009 |
| Total Posts: 1794 |
|
|
| 30 Mar 2015 03:22 PM |
sorry for the wall of text then
*cries* |
|
|
| Report Abuse |
|
|