Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

Shift to sprint with animation help?

Im trying to make a script to make it so that when the player presses shift the fov changes, speed changes and it plays my animation until shift is unpressed heres my current script:

local UIS = game:GetService('UserInputService')

local Player = game.Players.LocalPlayer

local Character = Player.Character

UIS.InputBegan:connect(function(input) if input.KeyCode == Enum.KeyCode.LeftShift then

	Character.Humanoid.WalkSpeed = 35

	local Anim = Instance.new('Animation')

	Anim.AnimationId = 'rbxassetid://7605028984'

	PlayAnim = Character.Humanoid:LoadAnimation(Anim)

	PlayAnim:Play()

end

end)

UIS.InputEnded:connect(function(input)

if input.KeyCode == Enum.KeyCode.LeftShift then

	Character.Humanoid.WalkSpeed = 16

	PlayAnim:Stop()

end

end)

1 answer

you should disable as a developer, you can go to StarterPlayer under your explorer window, navigate to your properties window, and disable "EnableMouseLockOption". This will automatically disable shift lock for ALL players of your game and fix your problem.

This discussion is preserved as it was. New answers, comments, and votes are closed.