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

Bodyvelocity help, parts not floating upward when script activates?

Asked by 8 years ago

Alright so basically I put bodyvelocity in a part so I can make the part float upward but it didn't work I even tried raising the force and velocity any idea why this isn't working? Also no errors in output. here is the code

p = script.Parent.Parent
c = p.Character
mouse = p:GetMouse()
hold = false

function charge(key)
    key:lower()
    if key == "z" then
        hold = true
        while hold == true do
            wait(3)
            h = Instance.new("Part",game.Workspace)
            h.Size = Vector3.new(math.random(1,2),.35,math.random(1,5.5))
            h.BrickColor = BrickColor.new("Pastel brown")
            h.TopSurface = "Smooth"
            h.BottomSurface = "Smooth"
            h.CanCollide = false
            g = Instance.new("BodyVelocity",h)
            g.maxForce = Vector3.new(0,math.huge,0)
            g.P = 100000
            g.Velocity = Vector3.new(0,math.huge,0)
            h.CFrame = c.Torso.CFrame*CFrame.new(math.random(-1,2),-1,0)
        end
    end
end

mouse.KeyDown:connect(charge)

Answer this question