Hey there! I’ve been stuck for a little while and browsing the forum looking for a solution, but have had no success.
Currently, I am making a cannon that allows the player to aim where they want on the client, and then fires an event with the CFrame which then the server uses to launch. However, I am not having any success with making it launch well and smoothly.
Here’s my code:
game.ReplicatedStorage.FireCannon.OnServerEvent:Connect(function(plr, barrelPrimary)
local char = plr.Character
local bodyVelocity = Instance.new("BodyVelocity")
local X, Y, Z = barrelPrimary:ToOrientation()
bodyVelocity.Velocity = Vector3.new(X*9,Y*9,Z*9)
bodyVelocity.MaxForce = Vector3.new(math.huge, math.huge, math.huge)
bodyVelocity.P = math.huge
bodyVelocity.Parent = char.HumanoidRootPart
--game:GetService("Debris"):AddItem(bodyVelocity,3)
end)
Thanks, Jail