Hi, I am making an impulse system for the player when he clicks on a part of the screen. What I want to know is how to make that boost from the character to the part. Every time the player clicks, a part is created, and the character would have to be boosted to that part, but I have no idea how to make that boost.
This is the code (Server):
local function createPart(origin, direction)
local midpoint = origin + direction/2
local p = Instance.new("Part",workspace.Cordroptero)
p.Anchored = true
p.CanCollide = false
p.CFrame = CFrame.new(midpoint, origin)
debris:AddItem(p, 1)
end
mouseHitEvent.OnServerEvent:Connect(function(plr, mouse, camera, rp)
local char = plr.Character
local hum = char:WaitForChild("Humanoid")
local params = RaycastParams.new()
params.FilterDescendantsInstances = {char}
params.FilterType = Enum.RaycastFilterType.Blacklist
local range = 40
local origin = rp.Position
local direction = (mouse - origin).Unit * range
local result = workspace:Raycast(origin, direction, params)
createPart(origin,direction)
end)