Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

What's the difference between hit.Parent and part.Parent?[solved]

Like

script.Parent.Touched:connect(function(hit)
	hit.Parent:findFirstChild("Torso")
end

vs

script.Parent.Touched:connect(function(part)
	part.Parent:findFirstChild("Torso")
end

Yes I did look it up http://gyazo.com/28ff4bffc4dbc02d6524ec28b0cd990c

5 comments

2

There no Difference between these two, just the names, but they serve the same Job.

0

Ah, answer so i can give you points!

0

You can just press the arrow on the Left of his comment and he'll gain a point.

0

I tough that didn't work :l

0

@super, Ok, I'll post an answer. @ Alpha, the Upvote on the comments are only for recommendations.

1 answer

✓ Accepted answer

There are no Difference between hit, and part(just the names), But they serve the same job. Like lets say I named it kick Now lets try it out on Studio:

script.Parent.Touched:connect(function(kick)
	print(kick.Parent)
end)

--[ [OUTPUT] ] = Player

This can also be useful for getting the Players, Characters, Humanoid from kick(hit/part), You may ask, How do I get the Player From kick? Well there is a function that does that, It's called GetPlayerFromCharacter. This helps Users gain properties from the Player.

This discussion is preserved as it was. New answers, comments, and votes are closed.