I am trying to make this script work when a specific boolvalue is true, but the problem is, it won't detect the boolvalue. Here is the script:
--- all this is just buttons and gui stuff ---
local pow = game.Players.LocalPlayer:WaitForChild("PlayerGui"):WaitForChild("PowerGui2"):WaitForChild("Frame")
local speed = pow.Select1
local invis = pow.Select2
-----------------------------------------------------
local m = game.Players.LocalPlayer:GetMouse()
db = true
if speed.Value.Value == true then
---- the stuff below is not important because I tested it and it works ---
m.KeyDown:Connect(function(k)
if k == "q" then
if db == true then
game.ReplicatedStorage.Speedparticle:Clone().Parent = game.Players.LocalPlayer.Character:FindFirstChild("UpperTorso")
game.Players.LocalPlayer.Character:FindFirstChild("Humanoid").WalkSpeed = 40
db = false
wait(10)
game.Players.LocalPlayer.Character:FindFirstChild("UpperTorso").Speedparticle:Remove()
db = true
game.Players.LocalPlayer.Character:FindFirstChild("Humanoid").WalkSpeed = 16
end
end
end)
end

3 comments
its important because KeyDown is deprecated. use UserInputService.InputBegan instead
Deprecated doesn't mean not working. KeyDown works for most keys and UserInputService can be a bit harder for people to understand.
Terrible argument. You shouldn't be using Deprecated items. Don't teach bad practices.