I create a ball, i want to player hold it about 3 seconds then throw follow mouse. I use bodyvelocity but it not work when i add wait(3) in. The ball will fall down. This is my script :
game.ReplicatedStorage.Events.FireC.OnServerEvent:Connect(function(player,mousePos) local dmg = 50 local character = player.Character local cre = character.Name local effects = game.ReplicatedStorage.Fire local fireBall = effects.FireTichQuaCau:Clone() fireBall.dmg.Value = dmg fireBall.creator.Value = cre fireBall.CFrame = character.HumanoidRootPart.CFrame + Vector3.new(0,50,0) --set position fireBall.Anchored = true --anchored to wait 3 senconds fireBall.Parent = workspace local velocity = Instance.new("BodyVelocity", fireBall) wait(3) fireBall.Anchored = false -- false anchored to throw velocity.Velocity = CFrame.new(fireBall.Position, mousePos).LookVector*100 end)
I really don't know how to do it myself, but you can check out this video, I think that's exactly what you want. I already tested it and it worked perfectly
I fixed it, the problem is not with the wait command. I have to increase maxForce for it