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

How Could I make my launch pad launch a player relative to its local rotation?

Asked by
iLordy 27
4 years ago

Recently I made this launch pad which currently launches the player upwards if they stand on it while it's active. However what I would like to accomplish is for the launch pad to launch the player towards the direction the launch pad is facing. For example: if my launch pad is rotated at a 45 degree angle I want it to launch the player at the angle that the launch pad is facing instead of just launching them up. How would I be able to accomplish this?

local jumpPower = 100 -- The power of the jump when a player jumps on this
local cooldown = 0.5
local isActive = true
script.Parent.Touched:connect(function(part)
    local player = game.Players:GetPlayerFromCharacter(part.Parent)
    if player and isActive == true then
        player.Character.Humanoid.JumpPower = jumpPower
        player.Character.Humanoid.Jump = true
        script.Parent.Sound:Play()
        script.Parent.BrickColor = BrickColor.DarkGray()
        isActive = false
        print(isActive)
        wait(cooldown)
        end
end)

script.Parent.TouchEnded:connect(function(part)

    local player = game.Players:GetPlayerFromCharacter(part.Parent)
    if player then
        player.Character.Humanoid.JumpPower = 50 -- Default jump power
        print(isActive)
    end

end)



while true do
    wait(5)
    if (isActive == false) then isActive = true print(isActive)
        script.Parent.BrickColor = BrickColor.new("Deep blue") end
end



Answer this question