im trying to launch the player where they look but for some reason, whenever i use it the player gets launch in the same random direction in the air every time
local plr = game:GetService("Players").LocalPlayer
local mouse = plr:GetMouse()
local char = plr.Character
local UIS = game:GetService("UserInputService")
local camera = workspace.CurrentCamera
local raycastparam = RaycastParams.new()
raycastparam.FilterDescendantsInstances = {char}
raycastparam.FilterType = Enum.RaycastFilterType.Blacklist
UIS.InputBegan:Connect(function(input,istyping)
if istyping then
return
elseif input.UserInputType == Enum.UserInputType.MouseButton1 then
local Rayc = workspace:Raycast(camera.CFrame.Position, camera.CFrame.LookVector * 90)
if Rayc then
local hit = Rayc.Instance
if not hit.Parent:FindFirstChild("Humanoid") then
print(hit)
local endpoint = Rayc.Position
print(endpoint)
local endpart = Instance.new("Part")
endpart.Parent = workspace
endpart.Position = endpoint
endpart.Size = Vector3.new(0.2,0.2,0.2)
endpart.Anchored = true
endpart.Material = Enum.Material.Neon
local slide = Instance.new("BodyVelocity")
slide.MaxForce = Vector3.new(1,1,1) * 30000
slide.Velocity = camera.CFrame.Position + endpart.Position * 50
slide.Parent = char.HumanoidRootPart
wait(0.1)
slide:Destroy()
endpart:Destroy()
end
end
end
end)