How to fix AlivnBlox's Crouching GUI?

Hello there, thank you for reading this. I have been following AlivnBlox’s Piggy’s series/tutorials and everything works well! That is except for the crouching GUI/button. The button is designed to make the player’s walkspeed to 14 and make them have a crouch animation. So far I tested all the possibilities and the only part that works is the walkspeed to 14, while the animation doesn’t work. (I tried diffrent animations and they all didn’t work. Also is not because of R15 and R6 I tried that and is still broken.)
Anyways here’s teh script:

local player = game.Players.LocalPlayer

local userInputService = game:GetService(“UserInputService”)

local animationID = “rbxassetid://3323577844”

local animPlaying = false

function crouch()
if player:FindFirstChild(“Contestant”) then
if not player:FindFirstChild(“Stuck”) then
if animPlaying == false then
local animObj = Instance.new(“Animation”)
animObj.AnimationId = animationID
local loadedAnim = player.Character.Humanoid:LoadAnimation(animObj)
loadedAnim:Play()
player.Character.Humanoid.WalkSpeed = 10
animPlaying = true
script.Parent.Crouch.ImageColor3 = Color3.fromRGB(26, 144, 255)
script.Parent.Crouch.TextLabel.BackgroundColor3 = Color3.fromRGB(26, 144, 255)
print(“Playing”)
else
print(“Stopping”)
for i , v in pairs(player.Character.Humanoid:GetPlayingAnimationTracks()) do
v:Stop()
end
player.Character.Humanoid.WalkSpeed = 16
animPlaying = false
script.Parent.Crouch.ImageColor3 = Color3.fromRGB(255,255,255)
script.Parent.Crouch.TextLabel.BackgroundColor3 = Color3.fromRGB(255,255,255)
end
end
end
end

userInputService.InputBegan:Connect(function(input,gpe)
if input.KeyCode == Enum.KeyCode.LeftControl then
print(“Corect input”)
crouch()
end
end)

script.Parent.Crouch.MouseButton1Click:Connect(function()
crouch()
end)

game.ReplicatedStorage.ToggleCrouch.OnClientEvent:Connect(function(visiblity)
script.Parent.Crouch.Visible = visiblity
for i , v in pairs(player.Character.Humanoid:GetPlayingAnimationTracks()) do
v:Stop()
end
player.Character.Humanoid.WalkSpeed = 16
animPlaying = false
script.Parent.Crouch.ImageColor3 = Color3.fromRGB(255,255,255)
script.Parent.Crouch.TextLabel.BackgroundColor3 = Color3.fromRGB(255,255,255)
end)

Also here’s the explorer for people wondering
Weird

1 Like

Any errors in the output?

(30 c)

1 Like

this is why i hate alvinblox’s piggy tutorial; giving a free place and therefore leaving people clueless as to how anything works cause they just copy and paste.

you need to make the animation id your OWN animation, animations are not sharable, make your own animation if you had watched the series and not copy and pasted code you would have seen that he says to do what i just said.

4 Likes

Alvin Blox explain’s everything well. The problem is that his audience isn’t advanced enough to know these things. It isn’t Alvin Blox’s fault.

3 Likes

I did that’s my own animation, also he dosen’t let us copy and paste, he’s worse. He makes us sit through 7 hours long tutorial without leaving the script so he gets the watch time and ad revenue.


Yep. I will check about it.

Of course he doesn’t. You would just take it and leave. He wants to teach you.

Ik I was trying to say he dosen’t lets us copy and paste.

@Alvin_Blox purposely does that, for the sake of the video to help people learn but not to help people copy and paste. I’ve found that frustrating at first but, I eventually found out how much I’ve learned.

Most likely it’s a typo in your code or Instance names(or no instance at all) that’s breaks everything.

Please format your code.

2 Likes

You have to put effort into making a game. Without the tutorial it would take much longer. I wouldn’t complain.

6 Likes

To be completely honest, these tutorials are made for those who have some experience.

It’s not really his fault, the fault goes to the people who decide to jump straight into this because it looks appetising.

Also tip for @aaaaaa66a6, first thing you do when something doesn’t go right, is check your output. It should be a natural instinct by now.

Edit: is that light mode? :face_with_raised_eyebrow:

2 Likes

you should just add a animation object into the script, and do this

local anim = script.CrouchAnim

local playanim = humanoid:LoadAnimation(anim)

function startcrouch()
    playanim:Play()
end)

and make sure your animation priority is Action or else other animations will play over it

1 Like