#Is there a way to make a script only work if shiftlock is toggled?

1 messages · Page 1 of 1 (latest)

shy dew
#

I'm trying to make a movement system, and I successfully made a script to dash directionally, and walk backwards, but it plays while unlocked, and moving towards the camera. If it only worked with shift lock it would work much better.

I am new to scripting

inland sage
#

there's probably a property for this somewhere but if not, try using userinputservice

wicked lavaBOT
#

studio** You are now Level 1! **studio

shy dew
#

i need a way to make the script recognize that im shiftlocked

wicked lavaBOT
#

studio** You are now Level 2! **studio

shy dew
#

but i dont know if doing "if key.KeyCode == Enum.KeyCode.S" can have a and statement after to make two requirements for it to run

inland sage
shy dew
#

id have to make shiftlock some kind of variable with a meaning for that to work

#

shiftlocked doesnt exist in the scripts dialect

#

like if i did to uis shiftlocked isnt a input

#

its a state that needs to be detected as true for its duration

#

i think

#

let me try that actually

inland sage
#

make one

#

and change it with a
if key.KeyCode == Enum.KeyCode.LeftShift then

#

that's what i meant

grizzled cobalt
#

UserInputService has a property called MouseBehavior which can me an Enum.MouseBehavior and Enum.MouseBehavior.LockCenter is shiftlock

primal tartan
#

I think this can help

grizzled cobalt
#

^ that's pretty much what I said

shy dew
#

how could i implement that though

#

it worked actually

#

but now if i unshiftlock while walking backwards it keeps playing

#

is there a way to constantly check if its shiftlocked

#

it only checks once right

#

to intiate the script

primal tartan
#

well you're in control of how many times it checks. You can use a while function

shy dew
#

thank you that worked

#

thank you all the help worked

#

how do i mark this post as solved