Need help with a function not running

So ive created this function that if a player uses the Proximityprompt, they get loaded into a cannon and get shot. Before i had it that when u touched a part then u would get shot this worked fine.

However now i tried replacing it with a proximityprompt and the code stops running somehow. Ive added a print where the codes stop running but i couldnt find the mistake. maybe someone can find the mistake that i cant see? :smiley:

local cannon = script.Parent.ProximityPrompt
local touched = false

	local char = touch.Parent	
	if game.Players:GetPlayerFromCharacter(char) and char:FindFirstChild("HumanoidRootPart") and touched == false and not char:FindFirstChild("HumanoidRootPart"):FindFirstChild("BodyVelocity") then
		print("Doesnt print this so mistake should be in the above line ^^")
		char.HumanoidRootPart.CFrame = script.Parent.Parent.Tele.CFrame
		touched = true
		local bodyVelocity ="BodyVelocity")
		bodyVelocity.Velocity =,200,150)
		bodyVelocity.MaxForce =, math.huge, math.huge)
		bodyVelocity.P = math.huge
		bodyVelocity.Parent = char.HumanoidRootPart
		touched = false

This is because the parameter is the Player instance that triggered it.

What should I change to make it work? Can’t figure it out yet

Simply remove the if statement that checks if the touch parameter is a player.