im having a problem where my value is setting to true but my code doesnt run,
local SuperSpeed = script:WaitForChild("SuperSpeed") local Fast = script:WaitForChild("Fast") local Intermediate = script:WaitForChild("Intermediate") local Slow = script:WaitForChild("Slow") local CharacterSpeed = script:WaitForChild("CharacterSpeed") if SuperSpeed.Value == true then print("AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA") game.Players.LocalPlayer.Character.Humanoid.WalkSpeed = 157 CharacterSpeed.Value = 157
i have a separate GUI to set the SuperSpeed Value to True, and it is setting it. but none of the code for the Value being true is being run,
The problem is that the statement checks if the value is true before the value was even set to true. In order to prevent this, you can use the Changed
event.
local SuperSpeed = script:WaitForChild("SuperSpeed") local Fast = script:WaitForChild("Fast") local Intermediate = script:WaitForChild("Intermediate") local Slow = script:WaitForChild("Slow") local CharacterSpeed = script:WaitForChild("CharacterSpeed") SuperSpeed.Changed:Connect(function() if SuperSpeed.Value == true then print("AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA") game.Players.LocalPlayer.Character.Humanoid.WalkSpeed = 157 CharacterSpeed.Value = 157 end end)
local BoolValue = Instance.new("BoolValue") BoolValue.Parent = script BoolValue.Value = true if BoolValue.Value then print('ebic!') end
I hope this helps out.