Draeton
|
  |
| Joined: 04 Jun 2012 |
| Total Posts: 4269 |
|
|
| 13 Sep 2012 03:54 PM |
If it can be helped, try not to totally gut and revamp my code. Or give answers without explanations.
So when I moved to test the to be given script, I came up with this: 15:51:35 - Players.Player424.PlayerGui.Log.Main:7: malformed number near '.8.Text' 15:51:35 - Players.Player424.PlayerGui.Log.Main:7: malformed number near '.8.Text'
Here is the script: --BEGINNING OF SCRIPT print("Script began.") function pageMAP(Player) print("The function was called.") if Player.Name == game.Players.LocalPlayer.Name and script.InUse.Value == false then script.InUse.Value = true game.Players.LocalPlayer.PlayerGui.Log.Window.8.Text = game.Players.LocalPlayer.PlayerGui.Log.Window.7.Text game.Players.LocalPlayer.PlayerGui.Log.Window.8.TextColor3 = game.Players.LocalPlayer.PlayerGui.Log.Window.7.TextColor3 game.Players.LocalPlayer.PlayerGui.Log.Window.7.Text = game.Players.LocalPlayer.PlayerGui.Log.Window.6.Text game.Players.LocalPlayer.PlayerGui.Log.Window.7.TextColor3 = game.Players.LocalPlayer.PlayerGui.Log.Window.6.TextColor3 game.Players.LocalPlayer.PlayerGui.Log.Window.6.Text = game.Players.LocalPlayer.PlayerGui.Log.Window.5.Text game.Players.LocalPlayer.PlayerGui.Log.Window.6.TextColor3 = game.Players.LocalPlayer.PlayerGui.Log.Window.5.TextColor3 game.Players.LocalPlayer.PlayerGui.Log.Window.5.Text = game.Players.LocalPlayer.PlayerGui.Log.Window.4.Text game.Players.LocalPlayer.PlayerGui.Log.Window.5.TextColor3 = game.Players.LocalPlayer.PlayerGui.Log.Window.4.TextColor3 game.Players.LocalPlayer.PlayerGui.Log.Window.4.Text = game.Players.LocalPlayer.PlayerGui.Log.Window.3.Text game.Players.LocalPlayer.PlayerGui.Log.Window.4.TextColor3 = game.Players.LocalPlayer.PlayerGui.Log.Window.3.TextColor3 game.Players.LocalPlayer.PlayerGui.Log.Window.3.Text = game.Players.LocalPlayer.PlayerGui.Log.Window.2.Text game.Players.LocalPlayer.PlayerGui.Log.Window.3.TextColor3 = game.Players.LocalPlayer.PlayerGui.Log.Window.2.TextColor3 game.Players.LocalPlayer.PlayerGui.Log.Window.2.Text = game.Players.LocalPlayer.PlayerGui.Log.Window.1.Text game.Players.LocalPlayer.PlayerGui.Log.Window.2.TextColor3 = game.Players.LocalPlayer.PlayerGui.Log.Window.1.TextColor3 print("Now the challenge.") if script.Jonathan.Value == 1 then game.Players.LocalPlayer.PlayerGui.Log.Window.1.Text = "Jonathan permits you a look at the map in front of him." game.Players.LocalPlayer.PlayerGui.Log.Window.1.TextColor3 = Color3.new(0, 0, 255) else game.Players.LocalPlayer.PlayerGui.Log.Window.1.Text = "Your attempt at examining the map in front of you fails at Jonathan's interruption." game.Players.LocalPlayer.PlayerGui.Log.Window.1.TextColor3 = Color3.new(0, 0, 255) end script.InUse.Value = false end end
game.Workspace.Pages.pageMAP.ClickDetector.MouseClick:connect(pageMAP) --END OF SCRIPT |
|
|
| Report Abuse |
|
|
Draeton
|
  |
| Joined: 04 Jun 2012 |
| Total Posts: 4269 |
|
|
| 13 Sep 2012 03:59 PM |
Just to clarify, children of 'Window' are TextLabels.
|
|
|
| Report Abuse |
|
|
|
| 13 Sep 2012 04:00 PM |
My poor eyes. Mind formatting it? Or something? |
|
|
| Report Abuse |
|
|
Draeton
|
  |
| Joined: 04 Jun 2012 |
| Total Posts: 4269 |
|
|
| 13 Sep 2012 04:02 PM |
| Sorry man, I'd like to keep this unchanged so I can determine what the current problem is. Just copy and paste it into a text editor. |
|
|
| Report Abuse |
|
|
GollyGreg
|
  |
| Joined: 22 May 2008 |
| Total Posts: 21835 |
|
|
| 13 Sep 2012 04:03 PM |
--BEGINNING OF SCRIPT print("Script began.") function pageMAP(Player) print("The function was called.") if Player.Name == game.Players.LocalPlayer.Name and script.InUse.Value == false then script.InUse.Value = true
for i = 8, 2, -1 do game.Players.LocalPlayer.PlayerGui.Log.Window[tostring(i)].Text = game.Players.LocalPlayer.PlayerGui.Log.Window[tostring(i-1)].Text game.Players.LocalPlayer.PlayerGui.Log.Window[tostring(i)].TextColor3 = game.Players.LocalPlayer.PlayerGui.Log.Window[tostring(i-1)].TextColor3 end
print("Now the challenge.") if script.Jonathan.Value == 1 then game.Players.LocalPlayer.PlayerGui.Log.Window.1.Text = "Jonathan permits you a look at the map in front of him." game.Players.LocalPlayer.PlayerGui.Log.Window.1.TextColor3 = Color3.new(0, 0, 255) else game.Players.LocalPlayer.PlayerGui.Log.Window.1.Text = "Your attempt at examining the map in front of you fails at Jonathan's interruption." game.Players.LocalPlayer.PlayerGui.Log.Window.1.TextColor3 = Color3.new(0, 0, 255) end script.InUse.Value = false end end
game.Workspace.Pages.pageMAP.ClickDetector.MouseClick:connect(pageMAP) --END OF SCRIPT
Its because you had to convert the numbers into strings, and I simply did that with the Window[tostring(i)] lines. I also made it easier to edit the script with the for loop. Every time it loops, 1 is subtracted from i; starting from 8 and ending at 2. |
|
|
| Report Abuse |
|
|
|
| 13 Sep 2012 04:04 PM |
Do (OtherStuff).Window["8"].Text = Whatever
And so forth.
† KMXD † |
|
|
| Report Abuse |
|
|
Draeton
|
  |
| Joined: 04 Jun 2012 |
| Total Posts: 4269 |
|
|
| 13 Sep 2012 04:04 PM |
| Need to clarify: Copy and paste into a text editor with word wrapping off, or if you have a monitor large enough to see how the lines actually end (Because on my screen stuff is being word wrapped and making it appear twice as long). |
|
|
| Report Abuse |
|
|
|
| 13 Sep 2012 04:08 PM |
Basically, you can't do " Window.8". So you can either do:
game.Players.LocalPlayer.PlayerGui.Log.Window["1"].Text = "Jonathan permits you a look at the map in front of him."
or
game.Players.LocalPlayer.PlayerGui.Log.Window:FindFirstChild("1").Text = "Jonathan permits you a look at the map in front of him."
† KMXD † |
|
|
| Report Abuse |
|
|
GollyGreg
|
  |
| Joined: 22 May 2008 |
| Total Posts: 21835 |
|
|
| 13 Sep 2012 04:12 PM |
Yes, Knightmare is exactly right.
And you can still use the for loop to write all 8 at once.
Just think of the variable i as 8 the first time, 7 the second, then 6 and so on
Essentially I used: game.Players.LocalPlayer.PlayerGui.Log.Window[tostring(8)].Text |
|
|
| Report Abuse |
|
|
Draeton
|
  |
| Joined: 04 Jun 2012 |
| Total Posts: 4269 |
|
|
| 13 Sep 2012 04:17 PM |
| Okay, but now I have a new problem. The property TextColor3 isn't changing, and when I copypastad a line changing such into the command bar while in solo, it caused a crash. |
|
|
| Report Abuse |
|
|
GollyGreg
|
  |
| Joined: 22 May 2008 |
| Total Posts: 21835 |
|
|
| 13 Sep 2012 04:19 PM |
| That's odd. Is it not changing during the Johnathan part? |
|
|
| Report Abuse |
|
|
Draeton
|
  |
| Joined: 04 Jun 2012 |
| Total Posts: 4269 |
|
|
| 13 Sep 2012 04:21 PM |
| Yea. It sets it to (0, 0, 1) instead. |
|
|
| Report Abuse |
|
|
GollyGreg
|
  |
| Joined: 22 May 2008 |
| Total Posts: 21835 |
|
|
| 13 Sep 2012 04:21 PM |
game.Players.LocalPlayer.PlayerGui.Log.Window.1.TextColor3 = BrickColor.new("Bright blue").Color
If it is, I would try changing the TextColor3 properties by using a BrickColor constructor as if it were a part and if you add .Color to the end of it, it'll translate that BrickColor into a Color3 value for you.
Color3's are a little tricky to use when you hard-write it out because I think you have to divide it by 10 or something to get it right. I cant remember off the top of my head, but BrickColor.new("Bright blue").Color will work just fine. |
|
|
| Report Abuse |
|
|
Draeton
|
  |
| Joined: 04 Jun 2012 |
| Total Posts: 4269 |
|
| |
|
GollyGreg
|
  |
| Joined: 22 May 2008 |
| Total Posts: 21835 |
|
|
| 13 Sep 2012 04:31 PM |
| Don't mention it. Good luck |
|
|
| Report Abuse |
|
|