#i need help in making crouch system

1 messages · Page 1 of 1 (latest)

plucky violet
#

hi

#

hello pyro fire

#

i hope you can help me

#

!

arctic sparrow
plucky violet
#

i didnt make any code. thats why. but i put a local script in starter character scripts

#

im a builder but i want to learn

arctic sparrow
plucky violet
#

my bad

uneven oarBOT
#

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

plucky violet
arctic sparrow
#

well then take the walking crouch and remove the walking part? 🤷

plucky violet
#

its easy to you. but for me its hard to even know what does these lines do 💀

dry bone
dry bone
#

make the walkspeed like half

#

normal walkspeed is 16

plucky violet
#

i also have a sprint system. when sprint is off. the speed is 10 and working as a walking anim. and when its on, the speed is 20, running. and when speed is 0, idle anim.

brave sundial
#

In 1 hour you could have your system js learn how to use the new input action system
Roblox made key binding moves really easy

#

Then 1 tutorial and your good

#

And you'll learn shit

arctic sparrow
plucky violet
#

alr whos the best youtuber teaching? (in arabic)

brave sundial
#

Just enable it ofc

arctic sparrow
brave sundial
arctic sparrow
#

it is studio only last i checked. you can't publish a game and have it work in the roblox player. has that changed?

dry bone
#

its basically instant

#

as long as you shut down all servers

plucky violet
#

cant js anyone write some codes for me?

brave sundial
#

But I haven't tested that

brave sundial
arctic sparrow
#

pretty excited for it, even at a cursory glance it looks very decent, means no one ever has to deal with the hotkeys/bindings pattern ever again, ias simply just deals with it

brave sundial
#

And then in your next idea you will have no new knowledge

plucky violet
#

how much time? do i get experienced in lua?

brave sundial
arctic sparrow
plucky violet
#

and how much time do i learn lua?

#

i dont have money ngl

brave sundial
#

I mean I've been doing lua for 3 weeks and I can make a full gameplay system

#

You can do a crouch system or other basic stuff quite fast

plucky violet
#

only 3 weeks?

dry bone
brave sundial
#

Yep couple hours a day

dry bone
plucky violet
brave sundial
#

2 hours a day and you will be chilling in a month

arctic sparrow
dry bone
plucky violet
#

in vscode

brave sundial
#

If you really want it 2 hours isn't a lot to ask

arctic sparrow
#

the results you get out of it are directly proportional to the work you put in.

plucky violet
#

im active these days. cause im on vacation from school. i would freetime for learning. maybe 7 hours a day. when could i learn lua if i do this?

dry bone
#

it really depends

#

but listen

#

dont focus on that

#

just do a week and see what you learn

arctic sparrow
plucky violet
#

i know functions and local... from js

dry bone
plucky violet
#

i would do that. but i am too lazy

dry bone
#

learn self discipline

#

people ask how do i learn code too quickly when the root problem is laziness in YOU

arctic sparrow
plucky violet
#

do i have to learn everything in roblox studio before coding??

dry bone
#

learn as you go

#

well thats what i did

arctic sparrow
#

it's easy to say it's easy when you haven't put in even a fraction of the work others have.

dry bone
#

yeah

#

its very draining to learn code

arctic sparrow
plucky violet
#

alr ty guys. imma try to make crouch system and i will send it here to see if i am good or nah .

#

cya

dry bone
#

cya

plucky violet
#

local PlaybackSpeedCrouched = 0.70
local PlaybackSpeedStanding = 1

#

what does this means?

#

@arctic sparrow @dry bone

#

whats playback

pulsar otter
#

google

dry bone
#

inheritly they mean nothing

#

but its probably referring to the speed of the animation

#

so when you crouch whatever animation is playing is a lot slower than when you are standing

plucky violet
#

local Player = game.Players.LocalPlayer
local Character = Player.Character or Player.CharacterAdded:Wait()
local Humanoid = Character:WaitForChild("Humanoid")

local UserInputService = game:GetService("UserInputService")
local TweenService = game:GetService("TweenService")

local AnimationID = "15411945306"
local CameraOffsetOn = Vector3.new(0, 0, 0)
local CameraOffsetOff = Vector3.new(0, 0, 0)

local WalkSpeedCrouched = 0 --ADJUST CROUCH SPEED HERE
local WalkSpeedStanding = 10 -- IF you using a SHIFT SPRINT or any other script, make sure walk speeds match up!!
local PlaybackSpeedCrouched = 0.70
local PlaybackSpeedStanding = 1

local Animation = Instance.new("Animation")
Animation.AnimationId = "rbxassetid://127936042364738" .. AnimationID
local CrouchAnimation = Humanoid:LoadAnimation(Animation)

local function setCrouchState(isCrouching)
if isCrouching then
Humanoid.WalkSpeed = WalkSpeedCrouched
TweenService:Create(Humanoid, TweenInfo.new(0.25), { CameraOffset = CameraOffsetOn }):Play()
Character.HumanoidRootPart.Running.PlaybackSpeed = PlaybackSpeedCrouched
Character.HumanoidRootPart.CanCollide = false
CrouchAnimation:Play()

    while wait() do
        if Humanoid.MoveDirection.Magnitude > 0 then
            CrouchAnimation:AdjustSpeed(1)
        else
            CrouchAnimation:AdjustSpeed(0)
        end
    end
else
    Humanoid.WalkSpeed = WalkSpeedStanding
    TweenService:Create(Humanoid, TweenInfo.new(0.25), { CameraOffset = CameraOffsetOff }):Play()
    Character.HumanoidRootPart.Running.PlaybackSpeed = PlaybackSpeedStanding
    Character.HumanoidRootPart.CanCollide = true
    CrouchAnimation:Stop()
end

end

UserInputService.InputBegan:Connect(function(input, gameProcessedEvent)
if not gameProcessedEvent then
if input.KeyCode == Enum.KeyCode.C then --buttons to crouch HERE ( make sure to change it on line 55 too)
setCrouchState(true)
end
end
end)

UserInputService.InputEnded:Connect(function(input, gameProcessedEvent)
if not gameProcessedEvent then
if input.KeyCode == Enum.KeyCode.C then -- buttons (make sure they match to the line above^^)
setCrouchState(false)
end
end
end)

#

here is the code

dry bone
#

ok

pulsar otter
#

ok

dry bone
#

what do you need

#

is there an error?

plucky violet
dry bone
#

just the speed of the animation

#

1 = normal speed
0.7 = a bit slower

plucky violet
#

and the crouch animation aint working

dry bone
#

show output

uneven oarBOT
#

studio** You are now Level 15! **studio

plucky violet
uneven oarBOT
#

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

dry bone
#

what spits out errors

plucky violet
#

oh alr wait

#

٠٣:٢٧:١٩.١٤٠ ---------------------- - Client
٠٣:٢٧:١٩.٢٢٥ Finished Loading Animation Mirrorer - Server
٠٣:٢٧:١٩.٢٢٦ Finished Loading Animation Mirrorer - Client
٠٣:٢٧:٢٠.١٧٣ Failed to load animation with sanitized ID rbxassetid://1279360423647381541: Animation failed to load, assetId: https://assetdelivery.roblox.com/v1/asset?id=1279360423647381541&serverplaceid=0 - Studio

dry bone
#

um

#

id's are not that long

#

you mustve pasted the wrong thing

plucky violet
#

btw i fixed it

pulsar otter
#

what was the fix

dry bone
#

nice

plucky violet
#

i put the animation code in the wrong place

dry bone
#

nice job

plucky violet
#

i put it here
Animation.AnimationId = "rbxassetid://127936042364738" .. AnimationID

but its supposed to be here
local AnimationID = "15411945306"

#

ik that from the .. AnimationID

dry bone
#

ahh i see

neat osprey
brave sundial
dry bone
#

phew i almost sent a really bad gif im glad thats what i clicked instead

neat osprey
#

Ahh laziness.

dry bone
neat osprey
#

What in the laziness

#

AI generating then asking systems

pulsar otter
#

bro are you arguing with yourself right now?

neat osprey
#

Watch this

#

Because we won’t make any systems for free here

dry bone
neat osprey
#

And you can choose the loser path (script generation) but you’ll stay inexperienced forever which is something I don’t think you want to be

neat osprey
dry bone
#

well ofc

pulsar otter
#

brother 😂 you act as if he cant learn it later

dry bone
#

but if you say that its implied that you wont do it for free

neat osprey
#

But I doubt he’ll pay

dry bone
#

without being a meanie

#

ykno

#

you have to attract a bee with honey not vinegar

neat osprey
#

Too late, theyve made me angry already

pulsar otter
#

😂 the Op is gone already

uneven oarBOT
#

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

neat osprey
dry bone
neat osprey
pulsar otter
#

fr tho, brawldevs guides were the first thing i watched, i think they were just in my recommended so i clicked on it

dry bone
#

but dont let that anger you

neat osprey
#

I watched the dev king tutorial

#

But i wish brawl dev’s tutorial were available back then

granite mirage
neat osprey
#

Right now

#

There are only advantages in watching the brawl dev tutorials

granite mirage
neat osprey
#

They are mid 2024/2025 videos

neat osprey
#

I’ve been scripting for 2 years and a half and Ive learned stuff in his last video

dry bone
#

unless you are over 25

granite mirage
#

im gonna check it, thanks xD

dry bone
#

then it is too late

dry bone
#

lol

brave sundial
#

X2 brawldev is more up to date

neat osprey
neat osprey
#

You might have already learned deprecated stuff with the dev king

#

Such as stuff that are now in the task library

#

And region3

granite mirage
#

right now i have a problem with the path service "human.MoveToFinished:Wait()" is making the character be like lagging after like 30 seconds of working

neat osprey
neat osprey
#

Pyro will explain why better than me

granite mirage
#

the service or that line?

#

cuz removing that line makes it works, but the character no longer jumps

pulsar otter
#

is Pyro here?

neat osprey
neat osprey
granite mirage
#

what can I use instead, I read the path documentation, but I didn't see much more than what I saw in the devking's video, maybe can i use the Blockedwaypoint instead, to make the player jump, but doing that i would need to make alot of "if" xD

uneven oarBOT
#

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

neat osprey
#

Id rlly know

brave sundial
#

I'm not to experienced in pathfinding so all I could say is go to a good YouTuber scriptor and see what he does

AI can be good to ask questions for as well

neat osprey
#

Ive used path finding months ago

#

You could check the magnitude between the Root and the Waypoint and check with a condition if it’s smaller or equal to a number you decide that defines the range required to move on

#

With a while loop

#

And if the condition is respected you can just break it to let the loop of waypoints continue

#
#

You can also do task.wait(magnitude/speed)

#

To calculate how long it takes for your NPC to reach it’s destination

#

@granite mirage

arctic sparrow
neat osprey
arctic sparrow
#

you may as well add a bunch of task.wait(3)'s everywhere, same thing

brave sundial
#

Is there a better service to use

neat osprey
arctic sparrow
brave sundial
#

For pathfinding I swear I saved a doc link pyro sent

#

Ahhh

granite mirage
arctic sparrow
neat osprey
#

Create another post and send your script there

#

Cuz yk id wanna flood OP’s post

granite mirage
#

xD

#

alr

pulsar otter
#

bruh 💀

brave sundial
neat osprey
arctic sparrow