I have a thing for a beizer curve fireball but it always turns right. Is there a way I could make it be random like turn left,up,right instead of just right?
code:
local MaxDistance = 10000000 --Maximum Distance in studs.
local duration = 5
function lerp(a, b, t)
return a + (b - a) * t
end
function quadraticBezier(t, p0, p1, p2)
local l1 = lerp(p0, p1, t)
local l2 = lerp(p1, p2, t)
local quad = lerp(l1, l2, t)
return quad
end
game.ReplicatedStorage.Fireball.OnServerEvent:Connect(function(plr,target)
local char = plr.Character
local magnitude = (char:FindFirstChild("HumanoidRootPart").Position-target).Magnitude
if magnitude <= MaxDistance then
local fireball = game.ReplicatedStorage:FindFirstChild("Assets"):FindFirstChild("Fireball"):Clone()
fireball.Anchored = true
fireball.Parent = workspace
fireball.Position = char.HumanoidRootPart.Position
local start = char:FindFirstChild("HumanoidRootPart").Position + Vector3.new(0,0,3)
local middle = (char.HumanoidRootPart.Position-target) + Vector3.new(0,30,0)
for i=1,100 do
fireball.Position = quadraticBezier(i/100,start,middle,target)
task.wait(0.01)
end
game.Debris:AddItem(fireball,duration+2)
end
end)
idk if im stupid but im only 13yrs old in algebra i didn’t learn this yet…