I’m trying to create a obby game, just to learn some stuff about scripting. Sorry if this is a dumb question
Also, do I need to name every Part that should do this in Workspace different?
I’m trying to create a obby game, just to learn some stuff about scripting. Sorry if this is a dumb question
Also, do I need to name every Part that should do this in Workspace different?
You dnt need to rename every part just insert a script inside the part with this code
script.Parent.Touched:Connect(function(hit)
if hit.Parent:FindFirstChild("Humanoid") then
script.Parent.CanCollide = false
script.Parent.Transparency = 1
end
end)
Hi, this works. Could you tell me how this line works:
if hit.Parent:FindFirstChild(“Humanoid”) then
specifically “Parent:FindFirstChild(“Humanoid”)”
And the “hit” is just your own name of the function right? It could just be whatever I want right?
hit is the instance that touches the part
.Parent is the Parent of the touching instance (in this case the character is the parent)
FindFirstChild basically searchs for the instance inside the parent
I don’t understand how the character is the Parent.
think of it like this: hit is just whatever touches the part. if a player touches the part, part of their character is now ‘hit’, and hit.parent is the parent of that part. so imagine your character’s foot becomes ‘hit’, in that case hit.parent would of course be the player’s character model