How to make it so this script enables and disables a jumping block

Hello! Im trying to make a button that enables a jumping block I made, but the issue is that whithout having to touch the Button you can still go on the jumping block/bounce pad and bounce up to the telaporter, heres the scripts.

Button Script

local Button13 = script.Parent
local JumpPart1 = workspace:WaitForChild("JumpPart1") -- change location if wrong
local ButtonActivatingPart13 = workspace:WaitForChild("ButtonActivatingPart13")
local Jumper = workspace.JumpPart1.Jumper
local debounce = false

local function PressedButton()
	wait(1)
	if not debounce then
		debounce = true
		-- activates the part
		Button13.ButtonActivatedSound:Play()
		Button13.BrickColor = BrickColor.new("Lime green")
		ButtonActivatingPart13.Transparency = 0.5
		ButtonActivatingPart13.CanCollide = false
		JumpPart1.Transparency = 0.1
		Jumper.Disabled = false

		wait(10)

		-- deactivates the part
		ButtonActivatingPart13.Transparency = 0
		ButtonActivatingPart13.CanCollide = true
		JumpPart1.Transparency = 0.7
		Jumper.Disabled = true
		Button13.BrickColor = BrickColor.new("Dark stone grey")
		debounce = false
	end
end

wait(3)
Button13.Touched:Connect(PressedButton) -- triggers the function in the parentheses when touched

Jumping Script

local DB = false

script.Parent.Touched:Connect(function(hit)
	if hit.Parent:FindFirstChild("Humanoid") and not DB then
		DB = true

		local humanoid = hit.Parent.Humanoid --No need to reference it again, as you've already checked for it
		humanoid.JumpHeight = 100
		wait()
		humanoid.Jump = true
		wait(.25)
		humanoid.JumpHeight = 7.2
		DB = false
	end
end)

I believe disabling the CanTouch property of a part makes it so that Touched events do not fire.

(Edit: this may cause the script to error, though.)

1 Like

accidently clicked the solution button

why would it disable it tho?

Because that’s what the purpose of the property is. You can read about it here: New Part Collision Property: CanTouch [ACTIVATED]