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

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

Asked by
M_PS 0
4 years ago

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

0
A) User input locally. B) RemoteEvents/Functions. DeceptiveCaster 3761 — 4y
0
How are the scripts supposed to look like? M_PS 0 — 4y
0
If you had shown code, I would have helped you out a bit more. I'll give you some links instead. DeceptiveCaster 3761 — 4y

1 answer

Log in to vote
0
Answered by 4 years ago

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)
Ad

Answer this question