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

If key is pressed certain script is disabled?

Asked by 3 years ago

I'm trying to make it so if a key is pressed (e), a script will be disabled. The script I want to disable is called "Footstep", basically a script that makes the player have footstep sounds when they walk. This is the script that I have been using, but it is not working.

game.Players.LocalPlayer:GetMouse().KeyDown:Connect(function(KeyPressed)
if KeyPressed == "e" then
game.Workspace.Footstep.Disable = true
end
end)

Sorry if this question has an obvious answer, I'm new to LUA. Thanks :)

0
use Keyboard input instead. raid6n 2196 — 3y
0
and it Disabled raid6n 2196 — 3y

3 answers

Log in to vote
0
Answered by 3 years ago
Edited 3 years ago

.Disabled?

also, being a bit more organized with the get mouse cant hurt...

Ad
Log in to vote
0
Answered by 3 years ago

game.Players.LocalPlayer:GetMouse().KeyDown:Connect(function(KeyPressed) if KeyPressed == "e" then game.Workspace.ScriptName:Destroy() end end) -- Did that work?

0
Will that completely destroy the script? I want it so if you release "E" the script will run again. SylvanPlayz 2 — 3y
Log in to vote
0
Answered by 3 years ago

Not only that, but you could stop the sound itself in the key pressed script

Answer this question