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

How do I make a sword have fire surround the blade when I press E and dissapear when pressed again?

Asked by 6 years ago

Hello! I am working on swords that are planned to have the functionality of above, and I cannot seem to get it to work, could any one of you extremely helpful people provide an answer? Thank you!

1 answer

Log in to vote
1
Answered by
Ziruken 139
6 years ago

You can make a bool variable inside the Tool's LocalScript and then use UserInputService to make it when the key is pressed.

The bool variable should be like this:

local boolvar = false -- or true

Here is a example:

-- LocalScript inside the tool

local tool = script.Parent
local enabled = false -- or true
local uis  = game:GetService('UserInputService')

tool.Equipped:Connect(function()
    uis.InputBegan:Connect(function(input)
        if input.KeyCode == Enum.KeyCode.E and not enabled then
            enabled = true -- Set to true when player pressed E
            -- Add Fire
        elseif enabled then
            enabled = false
            -- Remove Fire
        end
    end)
end)
0
^ Does not work, I am pretty sure it is something wrong with my add fire script.. Shadowpheonixx1 3 — 6y
Ad

Answer this question