KingJacko
|
  |
| Joined: 20 Jun 2008 |
| Total Posts: 3944 |
|
|
| 17 Jan 2014 08:00 PM |
So earlier i had a post about If and Then statements. So i KNOW that its not the script, but its not working. Its suppose to script when you touch the part, it changes the text of a Gui. Well, its not working. Here is the script:
a = Script.Parent.Parent b = game.StarterGui.IslandChecker.Frame.TextLabel function onTouched(hit) if a.Name == "Hi" then b.Text = "Hi" elseif a.Name == "Bye" then b.Text = "Bye" end end
script.Parent.Touched:connect(onTouched)
No red lines, and output says absolutely nothing
|
|
|
| Report Abuse |
|
|
|
| 17 Jan 2014 08:08 PM |
| Changing the StarterGui wont help. IT does nothing. |
|
|
| Report Abuse |
|
|
Azureous
|
  |
| Joined: 29 Jan 2012 |
| Total Posts: 25287 |
|
|
| 17 Jan 2014 08:10 PM |
--Touched Function --for loop (:GetPlayers()) --PlayerGui editing --Connect Touched w/ Event |
|
|
| Report Abuse |
|
|
KingJacko
|
  |
| Joined: 20 Jun 2008 |
| Total Posts: 3944 |
|
|
| 17 Jan 2014 08:10 PM |
| What are you both trying to say |
|
|
| Report Abuse |
|
|
KingJacko
|
  |
| Joined: 20 Jun 2008 |
| Total Posts: 3944 |
|
| |
|
KingJacko
|
  |
| Joined: 20 Jun 2008 |
| Total Posts: 3944 |
|
| |
|
qdhxx
|
  |
| Joined: 02 Jul 2010 |
| Total Posts: 56658 |
|
|
| 18 Jan 2014 07:22 AM |
Is the block's name "Hi"? It must be Hi to make to script work.
And if you want it to say "Bye", the block must be called "Bye". |
|
|
| Report Abuse |
|
|
KingJacko
|
  |
| Joined: 20 Jun 2008 |
| Total Posts: 3944 |
|
|
| 18 Jan 2014 07:23 AM |
| yes they are called Hi and Bye |
|
|
| Report Abuse |
|
|
vlekje513
|
  |
| Joined: 28 Dec 2010 |
| Total Posts: 9057 |
|
|
| 18 Jan 2014 07:24 AM |
StarterGui just copies all guis to the players PlayerGui ( Member of Player ) when they spawn.
Changing it will only change it when you spawn again.
You have to get the Player, then change the PlayerGui's child ( what the gui is called ).
So, do you want to change every player's PlayerGui or just one? |
|
|
| Report Abuse |
|
|
KingJacko
|
  |
| Joined: 20 Jun 2008 |
| Total Posts: 3944 |
|
|
| 18 Jan 2014 07:25 AM |
| so b(the variable) would really have to equal (hit).PlayerGui.IslandChecker.TextLabel? |
|
|
| Report Abuse |
|
|
KingJacko
|
  |
| Joined: 20 Jun 2008 |
| Total Posts: 3944 |
|
|
| 18 Jan 2014 07:28 AM |
isnt (hit) what hit the block in this script? Because i did this to try something out once.
(hit):Remove
and it worked |
|
|
| Report Abuse |
|
|
vlekje513
|
  |
| Joined: 28 Dec 2010 |
| Total Posts: 9057 |
|
|
| 18 Jan 2014 07:29 AM |
Yes.
But do you want to change everyone's PlayerGui or just one?
And (hit) is what hitted the block indeed. |
|
|
| Report Abuse |
|
|
KingJacko
|
  |
| Joined: 20 Jun 2008 |
| Total Posts: 3944 |
|
|
| 18 Jan 2014 07:31 AM |
| i want to change the players gui so one person could be on the "Hi" island and the gui will say Hi. Then another could be on the "Bye" island and his will say Bye |
|
|
| Report Abuse |
|
|
vlekje513
|
  |
| Joined: 28 Dec 2010 |
| Total Posts: 9057 |
|
|
| 18 Jan 2014 07:36 AM |
Ok, which players are they? And how do you index them? |
|
|
| Report Abuse |
|
|
KingJacko
|
  |
| Joined: 20 Jun 2008 |
| Total Posts: 3944 |
|
|
| 18 Jan 2014 07:37 AM |
| i dont mean specific players, just the ones that touch the island. |
|
|
| Report Abuse |
|
|
KingJacko
|
  |
| Joined: 20 Jun 2008 |
| Total Posts: 3944 |
|
|
| 18 Jan 2014 07:40 AM |
here let me rephrase my problem(even tho its already half solved).
I'm working on a script that when you touch a brick with the name of Hi or Bye, it will change the text of the persons gui. |
|
|
| Report Abuse |
|
|
KingJacko
|
  |
| Joined: 20 Jun 2008 |
| Total Posts: 3944 |
|
|
| 18 Jan 2014 07:43 AM |
| so i only want to change one |
|
|
| Report Abuse |
|
|
vlekje513
|
  |
| Joined: 28 Dec 2010 |
| Total Posts: 9057 |
|
|
| 18 Jan 2014 07:47 AM |
a = Script.Parent.Parent
function onTouched(hit) if hit.Parent.Humanoid then -- makes sure the block who touched the block has an humanoid, so is a player b = hit.Parent:GetPlayerFromCharacter -- gets player from the character if a.Name == "Hi" then -- if the scripts parent.parent name is "Hi" then it will launch b.PlayerGui.IslandChecker.Frame.TextLabel.Text = "Hi" -- changes the players PlayerGui into that. elseif a.Name == "Bye" then b.PlayerGui.IslandChecker.Frame.TextLabel.Text = "Bye" end end
script.Parent.Touched:connect(onTouched)
Try this |
|
|
| Report Abuse |
|
|
KingJacko
|
  |
| Joined: 20 Jun 2008 |
| Total Posts: 3944 |
|
| |
|
KingJacko
|
  |
| Joined: 20 Jun 2008 |
| Total Posts: 3944 |
|
|
| 18 Jan 2014 07:52 AM |
| wait ive got a red line, let me fix it |
|
|
| Report Abuse |
|
|
KingJacko
|
  |
| Joined: 20 Jun 2008 |
| Total Posts: 3944 |
|
|
| 18 Jan 2014 07:53 AM |
if a.Name == "Hi" then
thats the line i got a red line under :\ |
|
|
| Report Abuse |
|
|
KingJacko
|
  |
| Joined: 20 Jun 2008 |
| Total Posts: 3944 |
|
| |
|
vlekje513
|
  |
| Joined: 28 Dec 2010 |
| Total Posts: 9057 |
|
|
| 18 Jan 2014 07:58 AM |
a = Script.Parent.Parent
function onTouched(hit) if hit.Parent.Humanoid then -- makes sure the block who touched the block has an humanoid, so is a player b = hit.Parent:GetPlayerFromCharacter() -- gets player from the character if a.Name == "Hi" then -- if the scripts parent.parent name is "Hi" then it will launch b.PlayerGui.IslandChecker.Frame.TextLabel.Text = "Hi" -- changes the players PlayerGui into that. elseif a.Name == "Bye" then b.PlayerGui.IslandChecker.Frame.TextLabel.Text = "Bye" end end
script.Parent.Touched:connect(onTouched)
Try this then |
|
|
| Report Abuse |
|
|
Kingmouli
|
  |
| Joined: 28 Sep 2012 |
| Total Posts: 1292 |
|
|
| 18 Jan 2014 07:59 AM |
Try adding an end. Or just try this.
script.Parent.Touched:connect(function(hit) if hit.Parent:FindFirstChild("Humanoid") then plyr = game.Players:GetPlayerFromCharacter(hit.Parent) plyr.PlayerGui.YOURGUI.Text = "Hi/Bye" end end)
Note: You'll have to edit this script. |
|
|
| Report Abuse |
|
|
KingJacko
|
  |
| Joined: 20 Jun 2008 |
| Total Posts: 3944 |
|
|
| 18 Jan 2014 07:59 AM |
red line under this now:
script.Parent.Touched:connect(onTouched) |
|
|
| Report Abuse |
|
|