zabba7461
|
  |
| Joined: 21 Aug 2011 |
| Total Posts: 179 |
|
|
| 09 Mar 2012 09:14 PM |
I am trying to make a model OnTouch where it changes the text on a GUI. How do I access a player's PlayerGuis from their body in the workspace? Help please!
- - - - - - - - - - - Game - - - - - - - - - - - - Workspace - - - - - - - - - - - - - - - Players zabba (body) - - - - - - - - - - - - zabba7461 body part (touched part) - - - - - - PlayerGui - - - - - - - - - - - - - - - - - - - - - ScreenGui - - - - - - - - - - - - - - - - - - - - - Text Button |
|
|
| Report Abuse |
|
|
zabba7461
|
  |
| Joined: 21 Aug 2011 |
| Total Posts: 179 |
|
|
| 09 Mar 2012 09:15 PM |
| My problem is getting from the workspace to the players. |
|
|
| Report Abuse |
|
|
zabba7461
|
  |
| Joined: 21 Aug 2011 |
| Total Posts: 179 |
|
|
| 09 Mar 2012 09:19 PM |
| Anybody? Come on. Someone must know how... |
|
|
| Report Abuse |
|
|
billbull7
|
  |
| Joined: 18 Oct 2007 |
| Total Posts: 153 |
|
|
| 09 Mar 2012 09:36 PM |
function onTouch(Player) --onTouch start script local person = Player.Parent.Name --create for further use if game.Players.findFirstChild(..Player..)~=nil then --not sure if correct end end
That will locate the player if you need more, then explain. |
|
|
| Report Abuse |
|
|
zabba7461
|
  |
| Joined: 21 Aug 2011 |
| Total Posts: 179 |
|
| |
|
|
| 09 Mar 2012 09:45 PM |
Above won't work, try:
script.Parent.Touched:connect(function(hit) if hit.Parent:FindFirstChild("Humanoid") then local plyr = game.Players:GetPlayerFromCharacter(hit.Parent) -- Variable for player plyr --Whatever you want. Ex: plyr:FindFirstChild("leaderstats"), would find the player's leaderstats end end)
† KMXD † |
|
|
| Report Abuse |
|
|
billbull7
|
  |
| Joined: 18 Oct 2007 |
| Total Posts: 153 |
|
|
| 09 Mar 2012 09:46 PM |
| kmxd, i tried, it was just off the top of my head lol, if you gave me a few more minutes, i would've tested it, I was just too lazy :P |
|
|
| Report Abuse |
|
|
|
| 09 Mar 2012 09:46 PM |
No problem, you tried. :P
† KMXD † |
|
|
| Report Abuse |
|
|
billbull7
|
  |
| Joined: 18 Oct 2007 |
| Total Posts: 153 |
|
|
| 09 Mar 2012 09:49 PM |
| Plus the fact that this is my first month back after about 2 years. I'm glad I'm back, I miss the scripts and some games, though most people that were good either quit or became Moderators :/ |
|
|
| Report Abuse |
|
|
zabba7461
|
  |
| Joined: 21 Aug 2011 |
| Total Posts: 179 |
|
|
| 09 Mar 2012 09:52 PM |
I don't know. It isn't working....Did I do anything wrong here?
I took out the change the gui text part but my scripts aren't locating me.
Man = script.Parent.Parent
function onTouch(Player) --onTouch start script local person = Player.Parent.Name --create for further use if game.Players.findFirstChild(..Player..)~=nil then --not sure if correct
Man.Name = Player.Parent.Name.."" wait(2) Man.Name = "text 1" wait(5) Man.Name = "text 2" wait(5) Man.Name = "text 3" end end
script.Parent.Touched:connect(onTouched)
|
|
|
| Report Abuse |
|
|
|
| 09 Mar 2012 09:55 PM |
Use mine :o'
Man = script.Parent.Parent
script.Parent.Touched:connect(function(hit) if hit.Parent:FindFirstChild("Humanoid") then local plyr = game.Players:GetPlayerFromCharacter(hit.Parent) -- Variable for player Man.Name = plyr.Name.."" wait(2) Man.Name = "text 1" wait(5) Man.Name = "text 2" wait(5) Man.Name = "text 3" end end)
† KMXD † |
|
|
| Report Abuse |
|
|
billbull7
|
  |
| Joined: 18 Oct 2007 |
| Total Posts: 153 |
|
|
| 09 Mar 2012 09:57 PM |
You still need to locate the GUI, and try KMXD's, it's probably more right than mine. Anyway:
Note: the prints help tell where the script went wrong if no errors were thrown
Man = script.Parent.Parent --is this the GUI? if so, the gui should be in the StarterGui or implimented later
function onTouch(Player) --onTouch start script local person = Player.Parent.Name --create for further use print("Finished 1") if game.Players.findFirstChild(..Player..)~=nil then --not sure if correct print("Finished 2")
Man.Name = Player.Parent.Name.."" wait(2) Man.Name = "text 1" print("Finished 3") wait(5) Man.Name = "text 2" print("Finished 4") wait(5) Man.Name = "text 3" print("Finished 5") end end
script.Parent.Touched:connect(onTouched)
|
|
|
| Report Abuse |
|
|
zabba7461
|
  |
| Joined: 21 Aug 2011 |
| Total Posts: 179 |
|
|
| 09 Mar 2012 10:02 PM |
| Your post with the prints didn't show any. This is using output, right? |
|
|
| Report Abuse |
|
|
zabba7461
|
  |
| Joined: 21 Aug 2011 |
| Total Posts: 179 |
|
| |
|
zabba7461
|
  |
| Joined: 21 Aug 2011 |
| Total Posts: 179 |
|
|
| 09 Mar 2012 10:05 PM |
| KMDX's worked. Scripts were being unhelpful for me today. |
|
|
| Report Abuse |
|
|
zabba7461
|
  |
| Joined: 21 Aug 2011 |
| Total Posts: 179 |
|
|
| 09 Mar 2012 10:10 PM |
| Ok. So I want to do my Player.PlayerGui.ScreenGui.TextButton. I would use plyr.PlayerGui.ScreenGui.Textbutton? |
|
|
| Report Abuse |
|
|
zabba7461
|
  |
| Joined: 21 Aug 2011 |
| Total Posts: 179 |
|
|
| 09 Mar 2012 10:16 PM |
| I would like to thank both of you. I shouldn't have wasted all that time not seeking help on the forum. I hope I'll be able to craft this into an awesome place! |
|
|
| Report Abuse |
|
|
zabba7461
|
  |
| Joined: 21 Aug 2011 |
| Total Posts: 179 |
|
|
| 10 Mar 2012 07:04 PM |
shouldn't have talked so soon. I tried to make a response thing but whenever I add the click- response, it fails.
Man = script.Parent.Parent
script.Parent.Touched:connect(function(hit) if hit.Parent:FindFirstChild("Humanoid") then local plyr = game.Players:GetPlayerFromCharacter(hit.Parent) -- Variable for player gui = plyr.PlayerGui.Talk if script.Parent.Value.Value == true then script.Parent.Value.Value = false Man.Name = plyr.Name.."" gui.Questionbox.Text = "The man says your name" gui.Choiceone.Text = "Ok?" gui.Choicetwo.Text = "How do you know my name??" gui.Choicethree.Text = "*Yawwnnn*" end end end)
EVERYTHING ABOVE HERE IS OK AND WORKES PROPERLY ALONE
function Click() if gui.Questionbox.Text = "The man says your name" then
Man.Name = "You have visited zabba7461's place" Man.Name = "You have visited zabba7461's place" gui.Questionbox.Text = "He says you visited zabba7461's place. I guess you did..." gui.Choiceone.Text = "Ok thanks." gui.Choicetwo.Text = "Who is zabba7461? What's going on!?" gui.Choicethree.Text = "I don't know you, noob!" end end gui.Choiceone.MouseButton1Down:connect(Click) wait(5) Man.Name = "Come near to talk" |
|
|
| Report Abuse |
|
|