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: A quick question.

Previous Thread :: Next Thread 
thombot2 is not online. thombot2
Joined: 15 Oct 2008
Total Posts: 104
15 Jul 2013 12:34 AM
I know part.Parent:FindFirstChild("Humanoid") but is there anyway to find them in Players instead of Workspace. Maybe part.Parent:FindFirstChild("Players") or something. I am trying to make a onTouch script that will insert a gui into who ever touches it. So I want to find the persons local PlayerGui.
Report Abuse
CodyTheBuildingKid is not online. CodyTheBuildingKid
Joined: 13 Dec 2011
Total Posts: 4399
15 Jul 2013 12:39 AM
--Event stuff, Hit being the part that hit.

local Character = Hit.Parent
local Player = Game.Players:GetPlayerFromCharacter(Character)
if Player then
print(Player.PlayerGui)
end
Report Abuse
thombot2 is not online. thombot2
Joined: 15 Oct 2008
Total Posts: 104
15 Jul 2013 12:46 AM
So something like this?

local Character = Hit.Parent
local Player = Game.Players:GetPlayerFromCharacter(Character)
if Player then
game.Lighting.gui.Parent = Player.PlayerGui
end
Report Abuse
CodyTheBuildingKid is not online. CodyTheBuildingKid
Joined: 13 Dec 2011
Total Posts: 4399
15 Jul 2013 12:47 AM
Yep.
Report Abuse
blocco is not online. blocco
Joined: 14 Aug 2008
Total Posts: 29474
15 Jul 2013 12:47 AM
You'd want to clone it; otherwise it won't be there for the next person
Report Abuse
thombot2 is not online. thombot2
Joined: 15 Oct 2008
Total Posts: 104
15 Jul 2013 12:48 AM
Okay thank you.
Report Abuse
thombot2 is not online. thombot2
Joined: 15 Oct 2008
Total Posts: 104
15 Jul 2013 12:50 AM
Wait.

local Character = Hit.Parent
local Player = Game.Players:GetPlayerFromCharacter(Character)
if Player then
game.Lighting.Gui:Clone().Parent = Player.PlayerGui
end

This didn't work. Why is that?
Report Abuse
CodyTheBuildingKid is not online. CodyTheBuildingKid
Joined: 13 Dec 2011
Total Posts: 4399
15 Jul 2013 12:50 AM
Shouldn't it be 'gui'?
Report Abuse
thombot2 is not online. thombot2
Joined: 15 Oct 2008
Total Posts: 104
15 Jul 2013 12:51 AM
Nope the title of the Gui is spelt with a capital G. I went back and checked.
Report Abuse
thombot2 is not online. thombot2
Joined: 15 Oct 2008
Total Posts: 104
15 Jul 2013 12:56 AM
Did I do something wrong? I have tried multple times. I edited the script a few times too. It doesn't seem to work.
Report Abuse
smiley599 is not online. smiley599
Joined: 23 Jan 2010
Total Posts: 21869
15 Jul 2013 01:47 AM
What's the output?

Scripting Tutorials: youtube.com/user/smiley599roblox
Report Abuse
smiley599 is not online. smiley599
Joined: 23 Jan 2010
Total Posts: 21869
15 Jul 2013 01:50 AM
Also, thombot, when you said, "Maybe part.Parent:FindFirstChild("Players")", you suggested you did not know was the 'part' thing is. If you know what makes a player (eg. Head, Right Leg), copy this into a script, and drag it into a part.

function onTouched(hit)
print(hit.Name) -- I am not sure, should be just be print(hit)?
end
script.Parent.Touched:connect(onTouched)


Ignore the comment for now, go onto test and touch the part. What does it print?


Scripting Tutorials: youtube.com/user/smiley599roblox
Report Abuse
smiley599 is not online. smiley599
Joined: 23 Jan 2010
Total Posts: 21869
15 Jul 2013 01:50 AM
Looking back, I really should have used 'part' in the example. Urgh

Scripting Tutorials: youtube.com/user/smiley599roblox
Report Abuse
lax0131 is not online. lax0131
Joined: 20 Nov 2008
Total Posts: 132
15 Jul 2013 02:04 AM
hope you figure it out
Report Abuse
lax0131 is not online. lax0131
Joined: 20 Nov 2008
Total Posts: 132
15 Jul 2013 02:05 AM
Glad your on roblox your a great helper
Report Abuse
thombot2 is not online. thombot2
Joined: 15 Oct 2008
Total Posts: 104
15 Jul 2013 02:14 AM
I figured it out with tons of help. May I ask who you are "glad" is on roblox? Also who is a great helper?
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