|
| 27 Sep 2015 06:59 PM |
So in my game, I'm trying to get a GUI change text on click, and then teleport you. I have the first part, but I can't get it to teleport.
This is my script for changing text: local screenGui = Instance.new("ScreenGui") screenGui.Parent = script.Parent -- Create TextButton local textButton = Instance.new("TextButton") textButton.Parent = screenGui textButton.Position = UDim2.new(0, 25, 0, 50) textButton.Size = UDim2.new(0, 150, 0, 50) textButton.BackgroundColor3 = BrickColor.White().Color textButton.Text = "Teleport" -- Bind function to button click textButton.MouseButton1Down:connect(function() textButton.Text = "5" wait(1) textButton.Text = "4" wait(1) textButton.Text = "3" wait(1) textButton.Text = "2" wait(1) textButton.Text = "1" wait(1) end)
Any help?? |
|
|
| Report Abuse |
|
|
|
| 27 Sep 2015 07:00 PM |
| where is the teleporting code after the countdown? |
|
|
| Report Abuse |
|
|
|
| 27 Sep 2015 07:03 PM |
I put it under the textButton.Text = "1" wait(1)
|
|
|
| Report Abuse |
|
|
|
| 27 Sep 2015 07:04 PM |
| no you didnt, end) is after that. |
|
|
| Report Abuse |
|
|
|
| 27 Sep 2015 07:05 PM |
I put the script for the text change up there, this is the entire script:
local screenGui = Instance.new("ScreenGui") screenGui.Parent = script.Parent -- Create TextButton local textButton = Instance.new("TextButton") textButton.Parent = screenGui textButton.Position = UDim2.new(0, 25, 0, 50) textButton.Size = UDim2.new(0, 150, 0, 50) textButton.BackgroundColor3 = BrickColor.White().Color textButton.Text = "Teleport" -- Bind function to button click textButton.MouseButton1Down:connect(function() textButton.Text = "5" wait(1) textButton.Text = "4" wait(1) textButton.Text = "3" wait(1) textButton.Text = "2" wait(1) textButton.Text = "1" wait(1) wait(1) script.Parent.Parent.Parent.Parent.Character.Torso.CFrame = CFrame.new(-16.173, 18.199, -370.13) end) |
|
|
| Report Abuse |
|
|
litalela
|
  |
| Joined: 30 Mar 2010 |
| Total Posts: 6267 |
|
|
| 27 Sep 2015 07:06 PM |
textButton.Text = "5" wait(1) textButton.Text = "4" wait(1) textButton.Text = "3" wait(1) textButton.Text = "2" wait(1) textButton.Text = "1" wait(1) for i = 5, 1, -1 do textButton.Text = i wait(1) end wait(1)
➳Lɪᴛᴀʟᴇʟᴀ ɪs ᴍʏ ɴᴀᴍᴇ, Lᴜᴀ ɪs ᴍʏ ɢᴀᴍᴇツ |
|
|
| Report Abuse |
|
|
|
| 27 Sep 2015 07:07 PM |
| Explain that script please, I understand what it's doing but what do I do with it? |
|
|
| Report Abuse |
|
|
Blues714
|
  |
| Joined: 23 Dec 2008 |
| Total Posts: 6507 |
|
|
| 27 Sep 2015 07:09 PM |
for i = 5, 1, -1 do textButton.Text = i wait(1) end wait(1)
is a much more efficient way to counting down. |
|
|
| Report Abuse |
|
|
|
| 27 Sep 2015 07:10 PM |
He's telling you to replace your long line of wait(1) change text wait(1) change text and so on with a for loop like the one he posted.
-The [Guy] |
|
|
| Report Abuse |
|
|
|
| 27 Sep 2015 07:10 PM |
| Ah. I do things the old way, thank you for that much shorter script part. But the issue is still here about the teleporting |
|
|
| Report Abuse |
|
|
|
| 27 Sep 2015 07:14 PM |
local textButton = Instance.new("TextButton") textButton.Parent = screenGui textButton.Position = UDim2.new(0, 25, 0, 50) textButton.Size = UDim2.new(0, 150, 0, 50) textButton.BackgroundColor3 = Color3.new(1, 1, 1) textButton.Text = "Teleport" -- Bind function to button click textButton.MouseButton1Down:connect(function() for i = 5, 1, -1 do textButton.Text = i wait(1) end script.Parent.Parent.Parent.Parent.Character.Torso.CFrame = CFrame.new(-16.173, 18.199, -370.13) end)
Should work fine... |
|
|
| Report Abuse |
|
|
|
| 27 Sep 2015 07:20 PM |
| Nope, I put it in starterGUI and in a screen GUI and it doesn't TP nor does it countdown |
|
|
| Report Abuse |
|
|
|
| 27 Sep 2015 07:22 PM |
??? Put a print statement in the click function to see if it's even getting called.
-The [Guy] |
|
|
| Report Abuse |
|
|
|
| 27 Sep 2015 07:24 PM |
| It's not even being called. Weird. |
|
|
| Report Abuse |
|
|
|
| 27 Sep 2015 07:26 PM |
"Ah. I do things the old way, thank you for that much shorter script part. But the issue is still here about the teleporting"
The old way? That's not an "old way" That's an extremely dumb way. |
|
|
| Report Abuse |
|
|
| |
|
|
| 27 Sep 2015 07:30 PM |
| Nvm it is being called on, I just didn't see it. I had like 300 commands come in at once and I missed it. |
|
|
| Report Abuse |
|
|