I’m back again after a short period of time from my last post.
Making a 2d game is a bit difficult because there isn’t so much info or documentation when it comes to it.
Anyway I’ve been trying to do this for 3 days now. I want to make a fireball that would go where the player cursor is. Now I’ve been scripting for a while so this was relatively easy. Except for the cursor part. Every time I do this it turns out like this:
function abilities:NewFireball(plr, mlv)
local newFireball = game.ReplicatedStorage.AbilityParts.Fireball:Clone()
newFireball.CFrame = plr.Character.PrimaryPart.CFrame
newFireball.Parent = workspace.Skills
local connection
connection = game:GetService("RunService").Heartbeat:Connect(function(dt)
newFireball.CFrame = CFrame.new(newFireball.Position) + Vector3.new(mlv.X, mlv.Y*2, 0)
end)
task.delay(3, function()
connection:Disconnect()
newFireball:Destroy()
end)
end
mlv = mouse.Hit.LookVector
I’m almost sure this happens due to the fact that there is no Z value. If I change it so that it goes on the Z axis as well, it goes off the map but I can kind of make out that it’s accurate. Anybody got a solution?