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

Trying to push person parallel to surface, but pushes them at upwards angle?

Asked by 6 years ago

GIF of my issue.

I just don't understand why it wants to push the player into the air instead parallel to the baseplate's surface.

Any advice about where I went wrong would be great!

Here is the code I used for the circular pushing block:

local pusher = script.Parent

function handleTouch(otherPart)
if not buttonPressed then
buttonPressed = true 

    character = otherPart.Parent
    humanoid = character:FindFirstChild('Humanoid')
    local t = character:FindFirstChild("Torso")
    if humanoid and character.Name ~= script.Parent.Parent.Name then
        print("Found".. t.Name)
        wait()
        v = game.Lighting.BodyVelocity:Clone()
        v.Parent = character.Torso
        v.Velocity = Vector3.new(0,0,0)
        v.Script.Disabled = false
        wait()
        v.Velocity = (script.Parent.Position - t.Position).unit*-250 --pushes the pushee in the opposite direction of the pusher

    end
    wait()
buttonPressed = false
end
end
pusher.Touched:connect(handleTouch)

Answer this question