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

how to make a double jump particle effect?

Asked by 4 years ago

I want to know what i'm suppose to add to this script to make a cartoon like particle effect when someone double jumps. because i'm making a 3d platformer game like super mario 64 or a hat in time.

local UserInputSevice - game:GetSevice("UserInputSevice") local jumptick = tick() local Jumped = 1 local function onInputTypeBegan(input,gameProcessed if input.UserInputType == Enum.UserInputType.Keyboard then local keyPressed = input.keyCode if keyPressed = Enum.Keycode.Space then if Jumped == Enum.keycode.space then if jumped == 1 then jumped = 2 else if Jumped == 2 and tick() - lastjumptick <= .5 then local Jumpbrick.Cframe = instance.new("Part",workspace) JumpBrick.CFrame = game.players.localPlayer.Characther.HumaonidRootpart.CFrame * CFrame.new(0,-2,0) JumpBrick.Size = Vector3.new(5,.2,5) JumpBrick.Anchored = true JumpBrick.Transparency = 1 game.Players.LocalPlayer.Character.Humanoid.JumpPower = 60 game.Derbris:AddItem(JumpBrick,.1) wait(.5) game.Players.LocalPlayer.Character.Humanoid.jumpPower = 50 end wait(5) Jumped = 1 end lastjumptick = tick end end end

1 answer

Log in to vote
0
Answered by 4 years ago
Edited 4 years ago

i had a stroke trying to deconstruct this

anyways:

local UserInputSevice = game:GetService("UserInputService")
local plr = game.Players.LocalPlayer
local char = plr.Character
local hum = char:WaitForChild("Humanoid")

local canDJump = false
local hasDJumped = false

hum.StateChanged:Connect(function(old, new) --Detects many things, like if you landed or started falling
    if new == Enum.HumanoidStateType.Landed then --Checks if we landed
        canDJump = false
        hasDJumped = false
    elseif new == Enum.HumanoidStateType.Freefall then --Checks if we're falling
        wait(0.1) --Waits for we don't jump twice at once
        canDJump = true
    end
end)

UserInputSevice.JumpRequest:Connect(function() --Fires when the spacebar is held or pressed
    if not hasDJumped and canDJump then --If we haven't double jumped and can double jump
        canDJump = false
        hasDJumped = true
        hum.JumpPower = 75 --Just a boost 
        hum:ChangeState(Enum.HumanoidStateType.Jumping) --Makes us jump again
        --Add your special effects here, be it sounds, particles, whatever.
        hum.JumpPower = 50 --Sets it back to 50
    end
end)

Your whole script was kinda impractical, so I fixed it with my own I wrote in a few minutes. If you'd like me to make sounds/particles then reply!

Ad

Answer this question