I’m just trying to make it so the closer a player is to a this part that they click, the further they will be shot out relative to their look vector, mimicking an explosion. Results have not been promising, i sure this is a very easy fix that I am not seeing. Thanks.
event.OnClientEvent:Connect(function()
local rootpart = player.Character:FindFirstChild("HumanoidRootPart")
player.Character.Humanoid:ChangeState(Enum.HumanoidStateType.Flying)
local look = CFrame.new(root.Position, blastcenter.Position)
local dist = (blastcenter.Position - root.Position).Magnitude
local max_vel = 100
local radius = 5
local damp = radius^2/max_vel
local velocity = (max_vel - dist^2/damp)
if velocity > 0 then
root.AssemblyLinearVelocity = -look.LookVector * velocity
end
print(root.AssemblyLinearVelocity)
end)