Hey yall, im trying to make a ball that when pressed proximityprompt, it will kick into a random place in the lobby. But, there’s a problem. When i kick it, the ball collides and goes thru the lobby?? Help.
Code:
local replicatedstorage = game:GetService("ReplicatedStorage")
local evilball = workspace.EvilBall
evilball.Anchored = true
evilball.CanCollide = true
local kickheight = 1
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
proxprompt.Triggered:Connect(function(player)
local character = player.Character
local humanoid = character.Humanoid
local animator = humanoid.Animator
local randomnumber = math.random(0.1, 10)
local number = math.random(0.1, 1)
local pos = Vector3.new(number, randomnumber, number)
evilball.Anchored = false
replicatedstorage.RemoteEvent:FireClient(player, true)
local startposition = evilball.Position
task.spawn(function()
for i = 0, 1, 0.02 do
evilball.CFrame = CFrame.new(quadraticBezier(i, startposition, (startposition + pos) + Vector3.new(0, kickheight, 0), pos))
task.wait()
end
end)
task.wait(1)
replicatedstorage.RemoteEvent:FireClient(player, false)
end)