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

How can I make my character walk upside-down?

Asked by 4 years ago
Edited 4 years ago

So I'm making a game where u can toggle whether your character walks on the top or bottom of a brick.

I'm having some trouble making the character walk upside down though.

Basically, I've got it to a point where when you toggle it, the player goes upside down and flies into it using a VectorForce, however the issue is that I'm not 100% sure how to make the character actually walk on the roof or to make it jump for that matter. I'll give you part of the script (it's messy because I've got a short time-frame)

    if flip == true then

        local vectorforce = Instance.new("VectorForce")
        workspace.WorldWalls.Blue.Transparency = 1
        workspace.WorldWalls.Red.Transparency = 1
        vectorforce.Name = "force"
        vectorforce.Force = Vector3.new(0, 2500, 0)
        vectorforce.Parent = char.HumanoidRootPart
        vectorforce.RelativeTo = Enum.ActuatorRelativeTo.Attachment0
        vectorforce.Attachment0 = char.HumanoidRootPart.GravPull
        vectorforce.ApplyAtCenterOfMass = true

        char.HumanoidRootPart["Root Hip"].C1 = char.HumanoidRootPart["Root Hip"].C1*CFrame.Angles(math.rad(-180),0,0)
        char.HumanoidRootPart.Position = char.HumanoidRootPart.Position + Vector3.new(0,-magY*2,0)

        else

        workspace.WorldWalls.Blue.Transparency = 1
        workspace.WorldWalls.Red.Transparency = 0.05

        char.HumanoidRootPart["Root Hip"].C1 = char.HumanoidRootPart["Root Hip"].C1*CFrame.Angles(math.rad(-180),0,0)
        char.HumanoidRootPart.Position = char.HumanoidRootPart.Position + Vector3.new(0,-magY*2,0)
        char.HumanoidRootPart:WaitForChild("force"):Destroy()
    end
    end
end)

any answers would be appreciated! thanks

(if you need any more details then please just ask)

Answer this question