Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

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

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

✓ Accepted answer

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)

1 comment

0

^ Does not work, I am pretty sure it is something wrong with my add fire script..

This discussion is preserved as it was. New answers, comments, and votes are closed.