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

Why is bodyposition not trying to get to its set position?

Asked by 9 years ago

Screenshot: http://gyazo.com/8df4ef5372eb1e56527fc784ffa9fe04

The lower bodyposition parts are not trying to go up and the higher ones and not trying to go down. all of them need to try to get 10 blocks above surface but that is not happening. Can anyone help?

Code:

Blade = script.Parent:WaitForChild("Blade")
Enabled = script.Parent:WaitForChild("Enabled")
Height = script.Parent.Parent:WaitForChild("HoverHeight")
BPower = script.Parent.Parent:WaitForChild("BladePower")

function cH()
    local ray = Ray.new(script.Parent.Position, Vector3.new(0, -1, 0).Unit*500)
    local hit, hitPos = game.Workspace:FindPartOnRay(ray, script.Parent)
    return hit, hitPos, Height.Value, BPower.Value
end

while wait() do
    if Enabled.Value == true then
        local hit, hitPos, hoverHeight, BPower = cH()
        Blade.position = Vector3.new(0, hitPos.Y + hoverHeight, 0)
        Blade.P = BPower
        print("BladePos: "..tostring(Blade.position))
    else
        Blade.P = 0
    end
end
1
Please post your code so that we can actually see what you're doing wrong TurboFusion 1821 — 9y
0
Updated CodeSponge 125 — 9y

Answer this question