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
UIS.InputBegan:connect(function(input) On = false if input.KeyCode == Enum.KeyCode.LeftControl then If On == false then On = true While on do Wait() Character.Humanoid.WalkSpeed = 25 --- Load animation and stuff else print ("Stopped running") end 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:
local UIS = game:GetService("UserInputService") local toggle = false local player = game.Players.LocalPlayer local Character = player.Character UIS.InputBegan:Connect(function(input, gameProcessedEvent) if input.KeyCode == Enum.KeyCode.LeftControl then if toggle == false then toggle = true Character.Humanoid.WalkSpeed = 25 local Anim = Instance.new("Animation") Anim.AnimationId = "rbxassetid://04981880688" local PlayAnim = Character.Humanoid:LoadAnimation(Anim) PlayAnim:Play() else toggle = false Character.Humanoid.WalkSpeed = 16 local Anim = Instance.new("Animation") Anim.AnimationId = "rbxassetid://04981880688" local PlayAnim = Character.Humanoid:LoadAnimation(Anim) PlayAnim:Stop() end end end)
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.