i know a simple script but i guess i just forgot the basics or something `local UIS = game:GetService("UserInputService") local player = game.Players.LocalPlayer local Character = player.Character
UIS.InputBegan:connect(function(input) if input.KeyCode == Enum.KeyCode.LeftControl then Character.Humanoid.WalkSpeed = 25 local Anim = Instance.new("Animation") Anim.AnimationId = "rbxassetid://04981880688" --You Animation local PlayAnim = Character.Humanoid:LoadAnimation(Anim) PlayAnim:Play() end end)
UIS.InputEnded:connect(function(input) if input.KeyCode == Enum.KeyCode.LeftControl then Character.Humanoid.WalkSpeed = 16 local Anim = Instance.new("Animation") Anim.AnimationId = "rbxassetid://04981880688" local PlayAnim = Character.Humanoid:LoadAnimation(Anim) PlayAnim:Stop() end end)
here is the script i want to be able to tap left control and sprint however it makes me hold left control which is what i dont want
01 | UIS.InputBegan:connect( function (input) |
02 | On = false |
03 | if input.KeyCode = = Enum.KeyCode.LeftControl then |
04 | If On = = false then |
05 | On = true |
06 | While on do |
07 | Wait() |
08 | Character.Humanoid.WalkSpeed = 25 |
09 | --- Load animation and stuff |
10 | else |
11 | print ( "Stopped running" ) |
12 | end |
13 | end |
Try this, it has errors cause am trying on mobile and indenting wierd and annoys me so it not the full script... it a method I used to make a toggle for a text button... just fix the errors up since u said u already know some stuff
All you needed to add was a toggle:
01 | local UIS = game:GetService( "UserInputService" ) |
02 |
03 | local toggle = false |
04 |
05 | local player = game.Players.LocalPlayer |
06 |
07 | local Character = player.Character |
08 |
09 | UIS.InputBegan:Connect( function (input, gameProcessedEvent) |
10 |
11 | if input.KeyCode = = Enum.KeyCode.LeftControl then |
12 | if toggle = = false then |
13 | toggle = true |
14 | Character.Humanoid.WalkSpeed = 25 |
15 | local Anim = Instance.new( "Animation" ) |
Oh, and make sure this is in a local-script, and try to put this in StarterPlayer --> StarterPlayerScripts (not sure about this). Forgive my messy code.