Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

Need help shooting fireball in direction mouse is pointing at?

Asked by 2 years ago
local remote = game.ReplicatedStorage.remote


remote.OnServerEvent:Connect(function(plr, Player)
    print("hi")
    local fireBall = game.Workspace.fireball:Clone()
    fireBall.Parent = game.Workspace
    local humr = plr.Character.HumanoidRootPart
    fireBall.CFrame = humr.CFrame

    local mouse = plr:GetMouse()

    fireBall.Anchored = false
    local bVelocity = Instance.new("BodyVelocity",fireBall)
    bVelocity.MaxForce = Vector3.new(math.huge, math.huge, math.huge)
    bVelocity.Velocity = humr.CFrame.lookVector * 200 -- I set velocity here
end)

This is my fireball server code and this currently fires in direction player is looking at

but I want fireball go to mouse direction

1 answer

Log in to vote
0
Answered by 2 years ago
Edited 2 years ago

I solved this myself, instead of making fireball shoot at mousedirection, I can rotate player to look at direction i want

Ad

Answer this question