generic image
Processing...
  • Games
  • Catalog
  • Develop
  • Robux
  • Search in Players
  • Search in Games
  • Search in Catalog
  • Search in Groups
  • Search in Library
  • Log In
  • Sign Up
  • Games
  • Catalog
  • Develop
  • Robux
   
ROBLOX Forum » Game Creation and Development » Scripting Helpers
Home Search
 

Re: How do you find playergui thru touched?

Previous Thread :: Next Thread 
KingJacko is not online. KingJacko
Joined: 20 Jun 2008
Total Posts: 3944
21 Mar 2014 02:21 PM
How do i get the player's playergui thruogh a touch of a brick? When you touch something, it is like an arm or something in the character, so how do you get the player with his/hers backpack and playergui? I got this far:

function OnTouched(player)
gui = --how do i get the players playergui?
gui.Visible = true
repeat
gui.Transparency = gui.Transparency - .001
wait(.01)
until gui.Transparency == 0

end
script.Parent.Touched:connect(OnTouched)
Report Abuse
RoflBread is not online. RoflBread
Joined: 18 Jun 2009
Total Posts: 3803
21 Mar 2014 02:23 PM
function OnTouched(hit)
if hit.Parent:FindFirstChild("Humanoid") ~= nil then
local player = game.Players:GetPlayerFromCharacter(hit.Parent)
local playerGui = player.PlayerGui
end

Report Abuse
KnightmareXD is not online. KnightmareXD
Joined: 14 Jul 2009
Total Posts: 11189
21 Mar 2014 02:23 PM
function OnTouched(player)
local Player = Game.Players:GetPlayerFromCharacter(player.Parent)
if Player then
local gui = Player.PlayerGui["NAME OF GUI"]["NAME OF GUIOBJECT DESCENDANT"]
gui.Visible = true
repeat
gui.Transparency = gui.Transparency - .001
wait(.01)
until gui.Transparency == 0

end
end
script.Parent.Touched:connect(OnTouched)
Report Abuse
islandmaker2012 is not online. islandmaker2012
Joined: 07 Nov 2012
Total Posts: 9327
21 Mar 2014 02:26 PM
ok,first your gonna need to FIND the player

what the function will return is the "part" that touched it

function touch(thing)
print(thing.Name)
end

script.Parent.Touched:connect(touch)

output:
Part
Torso
Head
Left Arm

etc

so we want to "find the first child" in game.Players,that has the name

p = game.Players:findFirstChild(thing.Parent.Name)
if p then--if it finds the player
gui = p.PlayerGui.GuiName

so

function OnTouch(thing)
p = game.Players:findFirstChild(thing.Parent.Name)
if p then
gui = p.PlayerGui.GuiName.TextLabel
--continue
end
end
script.Parent.Touched:connect(OnTouch)
Report Abuse
KingJacko is not online. KingJacko
Joined: 20 Jun 2008
Total Posts: 3944
21 Mar 2014 02:28 PM
Knightmare's works thanks
also thanks island for the lesson ;)
Report Abuse
islandmaker2012 is not online. islandmaker2012
Joined: 07 Nov 2012
Total Posts: 9327
21 Mar 2014 02:30 PM
np
Report Abuse
Previous Thread :: Next Thread 
Page 1 of 1
 
 
ROBLOX Forum » Game Creation and Development » Scripting Helpers
   
 
   
  • About Us
  • Jobs
  • Blog
  • Parents
  • Help
  • Terms
  • Privacy

©2017 Roblox Corporation. Roblox, the Roblox logo, Robux, Bloxy, and Powering Imagination are among our registered and unregistered trademarks in the U.S. and other countries.



Progress
Starting Roblox...
Connecting to Players...
R R

Roblox is now loading. Get ready to play!

R R

You're moments away from getting into the game!

Click here for help

Check Remember my choice and click Launch Application in the dialog box above to join games faster in the future!

Gameplay sponsored by:
Loading 0% - Starting game...
Get more with Builders Club! Join Builders Club
Choose Your Avatar
I have an account
generic image