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 » Scripters
Home Search
 

Re: onTouched

Previous Thread :: Next Thread 
HatLicense is not online. HatLicense
Joined: 16 Mar 2015
Total Posts: 330
20 Feb 2016 11:47 PM

p.Touched:connect(function(hit)
if hit.Parent:FindFirstChild("Humanoid") then
if hit.Parent.Name ~= script.Name then
print(hit.Parent.Name)
end
end
end)

Basically, I've named this script after the player who activated the Shot, but for some reason It won't active at all, regardless of who it hits..
Report Abuse
swissmonk140 is not online. swissmonk140
Joined: 21 Jan 2008
Total Posts: 187
20 Feb 2016 11:51 PM
you have you hit.parent:findFirstCild(Humanoid")then
when it should be hit.Parent:FindFirstChild("players")then

you're attempting to get the name of the humanoid when the name of the humanoid is from the players and not from teh humanoid for the humanoid is in the gamespace and the players are just out of it onto the workspace
Report Abuse
swissmonk140 is not online. swissmonk140
Joined: 21 Jan 2008
Total Posts: 187
20 Feb 2016 11:53 PM
p.Touched:connect(function(hit)
if hit.Parent:FindFirstChild("Players") then
if hit.Parent.Name ~= script.Name then
print(hit.Parent.Name)
end
end
end)
Report Abuse
HatLicense is not online. HatLicense
Joined: 16 Mar 2015
Total Posts: 330
20 Feb 2016 11:56 PM
Why would 'Players' be within the Characters Model?

If I do that then it won't run at all because hit.Parnet:FindFirstChild("Players") does not even exist.
Report Abuse
myactivetestplace is not online. myactivetestplace
Joined: 11 Jul 2015
Total Posts: 3733
20 Feb 2016 11:59 PM
P.Touched:connect(function(hit)
local hum = hit.Parent:FindFirstChild("Humanoid")
If hum then
print(hum.Name)
end)
Report Abuse
HatLicense is not online. HatLicense
Joined: 16 Mar 2015
Total Posts: 330
21 Feb 2016 12:00 AM
... That would completely defeat the point of me renaming the Script after the Caster to avoid them being damaged by what they cast.
Report Abuse
swissmonk140 is not online. swissmonk140
Joined: 21 Jan 2008
Total Posts: 187
21 Feb 2016 12:16 AM
your going to have to assign a value to the players vs the humanoid in order to make this cross over because the values of the players is the "Name" of the players, but yeah it wont be relevent to the character, its in the other place.
Report Abuse
myactivetestplace is not online. myactivetestplace
Joined: 11 Jul 2015
Total Posts: 3733
21 Feb 2016 12:47 AM
When you touch a part its parent becomes a characters limb such as right arm or left arm so when you assign a variable such as local hum = hit.Parent which is the character you can find its child (humanoid)
Report Abuse
Previous Thread :: Next Thread 
Page 1 of 1
 
 
ROBLOX Forum » Game Creation and Development » Scripters
   
 
   
  • 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