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: How do I check what hit a part?

Previous Thread :: Next Thread 
WolfgangVonPrinz is not online. WolfgangVonPrinz
Joined: 24 Oct 2013
Total Posts: 4656
08 Jul 2015 02:03 PM
So I've got a tycoon functioning, but I have realised if something other than a player touches the tycoon, then it assigns that tycoon it something that isn't a player. I've tried to get it to find what the primary part is but I've had no luck. It doesn't read an error

script.Parent.Touched:connect(function(z)
if script.Parent.Parent.Name == "UnOwnedTycoon" and z.Parent.PrimaryPart == Head then

script.Parent.Parent.Name = z.Parent.Name .. "'s tycoon"
print(z)
print(z.Parent)


end
owner = z.Parent.Name
end)

▲☭⎊▲Obama is a giant overlord space lizard▲⎊☭▲
Report Abuse
igunaa is not online. igunaa
Joined: 15 Sep 2010
Total Posts: 2588
08 Jul 2015 02:06 PM
Try using Humanoid else than PrimaryPart == Head

It`d be like

script.Parent.Touched:connect(function(z)
if script.Parent.Parent.Name == "UnOwnedTycoon" and z.Parent.Humanoid ~= nil then

script.Parent.Parent.Name = z.Parent.Name .. "'s tycoon"
print(z)
print(z.Parent)


end
owner = z.Parent.Name
end)

Report Abuse
WolfgangVonPrinz is not online. WolfgangVonPrinz
Joined: 24 Oct 2013
Total Posts: 4656
09 Jul 2015 06:38 AM
That works great, thanks!

▲☭⎊▲Obama is a giant overlord space lizard▲⎊☭▲
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