Vectors and velocity and angle help please :D

Could somebody please help me with this.
I am making custom NoClip lua script that will not allow you to go trough stuff.
(Something like custom movement or something…)
How do i make the player move towards the position the player is looking at at the same speed?
That’s the code i got so far. xD



local patt = "Cartman300"
for k,v in ipairs(player.GetAll()) do
    if string.match(v:Name(),patt) then
        timer.Destroy("move")
        timer.Create("move", 0, 0, function()
        if (v:KeyDown(IN_FORWARD)) then
            v:SetVelocity(v:GetForward() * 15)
        end
        if (v:KeyDown(IN_BACK)) then
        
        end
        if (v:KeyDown(IN_MOVELEFT)) then

        end
        if (v:KeyDown(IN_MOVERIGHT)) then

        end
        if (v:KeyDown(IN_JUMP)) then
            v:SetVelocity(v:GetForward() + Vector(0, 0, 100))
        end
        if not v:KeyDown(IN_FORWARD) and not v:KeyDown(IN_BACK) and not v:KeyDown(IN_MOVELEFT) and not v:KeyDown(IN_MOVERIGHT) then
            v:SetVelocity(v:GetForward() - v:GetVelocity() + Vector(0, 0, 5))
        end
        end)
    end
end


EDIT: Oops, i screwed the code. xD

It’s much more complicated than that. Check out UClip.

No.
I am not making noclip replacement, i am making custom movement type. So i don’t have use of UClip.
Normal noclip will be still there.

Any reason you can’t just use the fly movetype?
It know it probably isn’t ideal given how you move around with fly but it should work.

If i knew how to tweak it’s speed then i would use it.