Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

How to make part move with BodyVelocity ?

Asked by 4 years ago
Edited 4 years ago

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)

2 answers

Log in to vote
0
Answered by 4 years ago
Edited 4 years ago

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

0
I can do like that but when i add command wait(3). It does not work tieuvuong07 -8 — 4y
Ad
Log in to vote
0
Answered by 4 years ago

I fixed it, the problem is not with the wait command. I have to increase maxForce for it

Answer this question