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

does anybody know how to show particle when press button E and disable when press button E?

Asked by 2 years ago

so I made a lightsaber with particles as the blade, and I want to use the button "E" to enable the particles so they show up and Then "E" to disable it as well.

0
pls someone tell me marcosoros 0 — 2y

1 answer

Log in to vote
0
Answered by
Puppynniko 1059 Moderation Voter
2 years ago

you can use UserInputService to detect if the player click E and use a Bool value to see if they clicked it before it would look like this

local UserInputService = game:GetService("UserInputService")
local Clicked = false
UserInputService.InputBegan:Connect(function(Input)
    if Input.KeyCode == Enum.KeyCode.E then
        if Clicked then
            Clicked = false
            print("Not On")
        else
            Clicked = true
            print("On")
            --turn on
            --the second time people click E the click variable will be false and turn off
        end
    end
end)
0
i put this script on the tool? marcosoros 0 — 2y
0
put this in a local script Puppynniko 1059 — 2y
Ad

Answer this question