Why isn't this working?

Hello, I’m trying to make a smash game on Roblox. I want to make it so that the player can jump from under the object like in smash. I made this script, but "hey!" is never printed.

Their are no error’s, what do I do??

local char = script.Parent
local hrp = char:WaitForChild("HumanoidRootPart")
local head = char:WaitForChild("Head")
local rayOrigion = Vector3.new(0, 8.25, 0)
local rayDirection = Vector3.new(0, 10, 0)

local raycastResult = workspace:Raycast(rayOrigion, rayDirection)

local part = Instance.new("Part", workspace)
part.Anchored = true
part.Position = rayOrigion
part.Size = (rayDirection - rayOrigion) + Vector3.new(1, 0, 1)
part.BrickColor = BrickColor.new("Persimmon")
part.CanCollide = false

part.Position = head.Position + Vector3.new(0, 1, 0)

local function touched(part)
	if part.Name == "floatingPlatform" then
		print("hey!")
	end
end

game:GetService("RunService").RenderStepped:Connect(function()
	part.Position = head.Position + Vector3.new(0, 1, 0)
end)

part.Touched:Connect(touched)

Why are you getting the name of the part?
The Part is already specified to the Touched Event, no need to do that

Plus, part isn’t Named floatingPlatform according to the script:


Try this:

local part = Instance.new("Part", workspace)
part.Name = "floatingPlatform"
part.Anchored = true
part.Position = rayOrigion
part.Size = (rayDirection - rayOrigion) + Vector3.new(1, 0, 1)
part.BrickColor = BrickColor.new("Persimmon")
part.CanCollide = false

that’s the raycast part for visualization.

I made another part cald floating Platform in which when touched by the raycast, it will move the player higher until they get on top of the platform.