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

What is "otherPart" parameter of a function?

I am making a game but dont know what this means since i am studying from roblox dev so i really wanna know it. The doubt is about "otherPart" parameter in the function

    local boostPart = script.Parent
    -- Set a variable for boosted jump power
    local BOOSTED_JUMP_POWER = 125
     
    local function onPartTouch(otherPart)
    	local partParent = otherPart.Parent
    	local humanoid = partParent:FindFirstChildWhichIsA("Humanoid")
    	if humanoid then
    		boostPart.CanCollide = false
    		local currentJumpPower = humanoid.JumpPower
    		if currentJumpPower < BOOSTED_JUMP_POWER then
    			humanoid.JumpPower = BOOSTED_JUMP_POWER
    			wait(10)
    			humanoid.JumpPower = currentJumpPower
    		end
    	end
    end
    boostPart.Touched:Connect(onPartTouch)

Thanks in advance, ayazi10

1 comment

0

otherPart is what is touched

1 answer

The otherPart parameter is what the boostPart touched. Lets say a players right foot touched the boostPart then otherPart would be the players right foot. The script then uses that to check if the parent of the rightFoot has a humanoid so it can see if it is a player.

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