ProximityPrompt calling 2 different functions?

Right now I have one proximity prompt “ProximityP” that raises the boat lift until “Bumper” is touched. Instead of having “ProximityP2” lower it back down with a seperate key bind how could i make “ProximityP” raise it before it hits “Bumper” and once they keybind is activated again bring it back down? thanks -

local ProxmityP2 = script.Parent.Parent.Parent.Parent.Model1.Prox.ProximityPrompt2
local Part1 = script.Parent.Parent.Parent.Model2.Bumper


ProxmityP.Triggered:Connect(function(player)

	script.Parent.Parent.Motor.LinearVelocity.VectorVelocity = Vector3.new(0,5,0)

	Part1.Touched:Connect(function(hit)
		script.Parent.Parent.Motor.LinearVelocity.VectorVelocity = Vector3.new(0,0,0)
	end)


		end)


ProxmityP2.Triggered:Connect(function(player)
	script.Parent.Parent.Motor.LinearVelocity.VectorVelocity = Vector3.new(0,-5,0)

	Part1.Touched:Connect(function(hit)
		script.Parent.Parent.Motor.LinearVelocity.VectorVelocity = Vector3.new(0,0,0)
	end)
end)

Local ProximityP didn’t show up after I posted but its above Local ProxmityP2 in the script

You can just have a variable that decides if the boat is lifted or not such as

local lifted = false

Then when the prompt is activated do lifted = not lifted. Check if it is lifted and then do one or the other based on which one it is.

local lifted = false
ProxmityP.Triggered:Connect(function(player)
    lifted = not lifted

    if lifted then
	-- if it needs to be lifted
    else
    -- if it needs to go down
    end
end)

Thank you that worked perfectly!

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.