So, I have this throwable ball but it’s seems to move fairly choppily at the beginning, does anyone know why?
robloxapp-20210518-1606302.wmv (536.6 KB)
(converting this to an mp4 wrecked the video itself for some reason that’s why I kept is as a wmv)
--Event Variables
local fPressed = script.Parent:WaitForChild("FPressed")
--Asset Variables
local handle = script.Parent:WaitForChild("Handle")
local function onServerEvent(player)
local char = player.Character
local newBall = handle:Clone()
newBall.CFrame = char.HumanoidRootPart.CFrame
local anim = Instance.new("Animation")
anim.AnimationId = "rbxassetid://6831445023"
local animTrack = char.Humanoid:LoadAnimation(anim)
animTrack:Play()
animTrack.Stopped:Wait()
local bodyVel = Instance.new("BodyVelocity")
bodyVel.MaxForce = Vector3.new(5000, 1000, 5000)
bodyVel.Velocity = (handle.CFrame.LookVector * 100)
bodyVel.Parent = newBall
newBall.Parent = workspace
script.Parent:Destroy()
local touchCon
touchCon = newBall.Touched:Connect(function(hit)
local humanoid = hit.Parent:FindFirstChild("Humanoid")
if humanoid then
if hit.Parent.Name ~= char.Name then
hit.Parent:BreakJoints()
if touchCon ~= nil then
touchCon:Disconnect()
end
newBall:Destroy()
end
end
end)
wait(2)
if touchCon ~= nil then
touchCon:Disconnect()
end
newBall:Destroy()
end
fPressed.OnServerEvent:Connect(onServerEvent)