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
I've moved the speed value check to the following if statement. With this when Key Down is connected it will check if speed value is true and the right key is pressed. Hope this helps
--- 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 ---- the stuff below is not important because I tested it and it works --- m.KeyDown:Connect(function(k) if speed.Value.Value == true and 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)