So, i am making a sort of "dash" system, where the player will teleport 50 studs in front of them or if there's a wall in the way, as many studs needed to hit the wall. Well, there's supposed to be a hitbox spawning in front of me and oriented so the hitbox is visualizing the dash length.
Well, that's not what really happened, the sizing works, however the orientation and positioning is all wrong, it does not visualize the dash length properly, and it's not even in front of the player.
this is the script ```lua
local ray = workspace:Raycast(RayPos, RayDirection, RayParams)
if ray then
local hit = ray.Instance
local pos = ray.Position
if hit.CanCollide then
deb = true
Hum.WalkSpeed = 0
Hum.JumpPower = 0
HRP.Anchored = true
local Hitbox = Instance.new("Part", workspace)
Hitbox.Size = Vector3.new(ray.Distance, 5, 5)
Hitbox.Orientation = HRP.Orientation
Hitbox.Anchored = true
Hitbox.CanCollide = false
Hitbox.CFrame = CFrame.new(HRP.CFrame.LookVector, HRP.CFrame, HRP.CFrame)
task.wait(1)
char:PivotTo(CFrame.new(pos))
task.wait(0.25)
Hum.WalkSpeed = 16
Hum.JumpPower = 50
HRP.Anchored = false
deb = false
return
end
end
polz hlelp
** You are now Level 6! **