local Player = game:GetService('Players').LocalPlayer local Character = Player.Character or Player.CharacterAdded:Wait() local Humanoid = Character:WaitForChild('Humanoid') local Mouse = Player:GetMouse() local Power = game.Players.LocalPlayer.leaderstats.Power while true do if Power.Value == "Super Speed" then Mouse.KeyDown:connect(function(key) if (key == "c") then if Humanoid.Walkspeed == 50 then Humanoid.WalkSpeed = 10 elseif Humanoid.WalkSpeed == 10 then Humanoid.WalkSpeed = 50 end end end end)
Okay, I think you're a little confused about how the ends work. When you have an elseif statement along with an if statement, it only requires one end, not one for every if.
Here's how you would arrange the ends:
local Player = game:GetService('Players').LocalPlayer local Character = Player.Character or Player.CharacterAdded:Wait() local Humanoid = Character:WaitForChild('Humanoid') local Mouse = Player:GetMouse() local Power = game.Players.LocalPlayer.leaderstats.Power while true do if Power.Value == "Super Speed" then Mouse.KeyDown:Connect(function(key) if key == "c" then -- You also don't need the parenthesis here. if Humanoid.Walkspeed == 50 then Humanoid.WalkSpeed = 10 elseif Humanoid.WalkSpeed == 10 then Humanoid.WalkSpeed = 50 end -- Ends off the inner-most if statement. end -- Ends the "if key == "c"" end) -- Ends the KeyDown event. end -- Ends the original if statement.
I think for the most part, you're just overcomplicating it, but that's okay, as long as you learn in the end.