im making a Stun Skill to my game and i need disable keys Q and LeftShift, the why, Q is a Dash thing and LeftShift is a Sprint thing what broke the Stun skill, then i want disable these buttons when stunned, how can i make it?
COMMUNITY QUESTION
How do i can disable a button to the players?
1 answer
Well, I actually wouldn't disable the buttons.
When the player is stunned, make a folder called "Stunned" inside of the player. Perform a check at the start of the script, if it's a local script I REALLY recommend that you perform a server-sided check.
An example of the check would be:
-- plr variable here
if plr:FindFirstChild("Stunned") then return end
Then, to remove that stun, you can actually use the "Debris" service. One of the uses of the debris service is to destroy objects with a delay. I'll give you an example on how to perform this action.
local Debirs = game:GetService("Debris") -- put this at the start of your script
local UnstunTime = 1 -- put this at the start of your script, too, and customize it to your needs
local Stun = Instance.new("Folder")
Stun.Name = "Stunned"
Stun.Parent = enemyPlayer -- change this to your variable name
Debris:AddItem(Stun,UnstunTime)
Please, mark this as the answer if you found this helpful.
This discussion is preserved as it was. New answers, comments, and votes are closed.

2 comments
Disable the function it's connected to.
wt? how?