Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

Shift to sprint with animation help?

Asked by 2 years ago

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

Log in to vote
0
Answered by
mroaan 95
2 years ago
Edited 2 years ago

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.

Ad

Answer this question