#Sprint script (formerly called: why doesnt this script work?)

1 messages · Page 1 of 1 (latest)

fallow scroll
#

(everything im tryna do now is purely cosmetic)

lusty quarry
#

I think you need to put “”

#

on the words that is red

fallow scroll
#

why exactly

#

just asking

lusty quarry
#

that’s how it works

fallow scroll
#

great explanation

#

they turn into strings

lusty quarry
#

wait

#

yes put “ and “

#

I think

dreamy arch
#

"message" is a string

#

message is a variable named message

fallow scroll
#

what

lusty quarry
#

Put “Players”

#

Instead of just Players

dreamy arch
#

red text

#

red squiggly underline

fallow scroll
#

ooooh

#

I thought you meant the text that was already red

#

like the whole thing

lusty quarry
#

uh

#

the text that is red inside of the ()

#

put “

fallow scroll
#

ok now it should work

austere nicheBOT
#

studio** You are now Level 4! **studio

lusty quarry
#

on both sides

fallow scroll
#

I also forgot to edit the line at the end

#

it still doesnt work

#

😭

lusty quarry
#

wait

dreamy arch
fallow scroll
lusty quarry
#

is onInputEnded a thing

fallow scroll
#

this is what it looks like now btw

dreamy arch
#

and you're trying to connect a callback named onInputEnded to the event UserInputService.InputEnded

#

oh you fixed that

lusty quarry
#

It should probably work

fallow scroll
#

is oninputstarted even a real thing

dreamy arch
#

so this is a local script?

fallow scroll
#

yes

dreamy arch
#

there's InputBegan

dreamy arch
fallow scroll
fallow scroll
dreamy arch
#

are there any errors

lusty quarry
#

use output

dreamy arch
#

name is lowercase here but it's not red

fallow scroll
#

still doesnt work

dreamy arch
#

don't say it "doesn't work"

#

say it does nothing

#

or does something you wouldn't expect it to

#

say what that is

fallow scroll
#

nothing

lusty quarry
#

Is if processed event then return end

#

I’m new

#

To scripting

dreamy arch
#

you're checking UserInputType

fallow scroll
#

yes

dreamy arch
#

that's not a keycode

fallow scroll
#

if its the leftshift type

#

wah

dreamy arch
#

it's one of these

#

check inputObject.KeyCode

fallow scroll
#

where are you finding this

#

is it in the documentation

dreamy arch
#

yeah

fallow scroll
#

DAYUM

#

there's a lot of stuff here

dreamy arch
#

you don't have to learn all of it

#

that's what documentation is for

fallow scroll
#

I know

#

but its good to have if I wanna make stuff

#

idk how to word it

lusty quarry
#

Does it work now

austere nicheBOT
#

studio** You are now Level 3! **studio

fallow scroll
olive sphinx
fallow scroll
olive sphinx
#

as a input

fallow scroll
#

yes

olive sphinx
#

and leftshift is

#

shiftlock keybind

#

it wont work

#

boom

fallow scroll
#

I have shiftlock disabled

olive sphinx
#

oop

#

well

#

userinputtype

#

is different

#

try KeyCode

#

input.KeyCode

#

userinputtype is usually for

#

mouse things

#

yk

#

mouse move or lmb rmb blabla

fallow scroll
#

sorry I was doing other stuff

fallow scroll
#

but I can try inputobject

#

nope

#

that wont work

olive sphinx
fallow scroll
#

strange

#

it doesnt appear like that for me

olive sphinx
#

can you provide me the

#

full script?

#

ill fix it for u

fallow scroll
olive sphinx
#

not a screenshot

fallow scroll
#

wdym

olive sphinx
#

can you paste it here

#

please

lusty quarry
#

send the text

fallow scroll
#

okay, but I wanted to do it myself with help

local UserInputService = game:GetService("UserInputService")

local function onInputStarted(inputObject, processedEvent)
    if processedEvent then return end
    
    if inputObject.UserInputType == Enum.KeyCode.LeftShift then
        print("Shift key pressed" .. inputObject.KeyCode.Name)
    end
end

UserInputService.InputEnded:Connect(onInputStarted)```
dreamy arch
#

i told you this

fallow scroll
#

what

#

Ion get it

#

what does it mean

olive sphinx
#
local Players = game:GetService("Players")
local UserInputService = game:GetService("UserInputService")

local function onInputStarted(inputObject, processedEvent)
    if processedEvent then return end

    if inputObject.KeyCode == Enum.KeyCode.LeftShift then
        print("Shift key pressed" .. inputObject.KeyCode.Name)
    end
end

UserInputService.InputBegan:Connect(onInputStarted)
#

here you go

lusty quarry
#

switch it I think

dreamy arch
#

it's never a KeyCode

#

you have to check the KeyCode property of the InputObject

fallow scroll
#

wait I'm still trying to process allat

austere nicheBOT
#

studio** You are now Level 5! **studio

fallow scroll
#

completely forgot about this

#

YES

#

IT WORKS NOW

#

TYSM

#

I mean, I still have to change what it does

#

but its a good start

olive sphinx
#

ywyw

fallow scroll
#

this is what it outputs btw

#

how do I findfirstchild

#

I love it when it just does all the work for me

lusty quarry
#

some times it’s not correct though

fallow scroll
#

Ik

lusty quarry
#

why do u need it to print when shift key pressed

fallow scroll
#

to check if it can even detect that im pressing shift

#

it works but its kinda ass

lusty quarry
#

you can make it do a sprint

fallow scroll
#

wdym

lusty quarry
#

like when u hold shift it makes u sprint

fallow scroll
#

yes

#

that was the plan

#

I also want it to change the animation later

#

but thats a whole other can of worms

fallow scroll
#

but I need to make it go back to 16 somehow

#

I'll try doing the opposite

#

on ended

#

alr it works

#

:D

#

imma rename the thread

#

Sprint script (formerly called: why doesnt this script work?)

#

im also going to make a sprint animation and I'll be back afterwards

fallow scroll
#

okay so I suck at animating

#

so I just took my walkanim and sped it up

#

81630182425656

#

how would I make the script change the anim

thick edge
#

probably

#

idk