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

How do I make something visible/invisible when a letter is pressed?

I created a sword trail which is attached, and I am wondering how to make it optional to have the sword trail in the game. I want everyone to see whether a person has it on or not

5 comments

0

A) User input locally. B) RemoteEvents/Functions.

0

How are the scripts supposed to look like?

0

If you had shown code, I would have helped you out a bit more. I'll give you some links instead.

1 answer

Here's a sample that you could work with:

 -- LocalScript
local part = workspace:WaitForChild("Baseplate")
local key = Enum.KeyCode.H -- Press H to toggle visibility of part value

game:GetService("UserInputService").InputEnded:Connect(function(input, typing)
    if not typing and input.UserInputType == Enum.UserInputType.Keyboard then
        if input.KeyCode == key and part then
            if part.Transparency == 1 then
                part.Transparency = 0
            else
                part.Transparency = 1
            end
        end
    end
end)

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