Hey, im making a server sided crouching script for my backrooms game, it works, however, the crouching animation wont stop when i stop holding the button, can anyone help?
a part of the local script
us.InputBegan:Connect(function(input)
if input.KeyCode == Enum.KeyCode.C then
crouchserver:FireServer("Play")
end
end)
us.InputEnded:Connect(function(input)
if input.KeyCode == Enum.KeyCode.C then
crouchserver:FireServer("Stop")
end
end)
server script
local rs = game:GetService("ReplicatedStorage")
local event = rs.crouchserver
event.OnServerEvent:Connect(function(player, bool)
local player = player
local character = player.Character or player.CharacterAdded:wait()
local hum = character:FindFirstChild("Humanoid")
local hmrp = character:FindFirstChild("HumanoidRootPart")
local animation = Instance.new("Animation")
animation.AnimationId = "http://www.roblox.com/asset/?id=9264758487"
local animation2 = hum:LoadAnimation(animation)
local originalwalkspeed = hum.WalkSpeed
if bool == "Play" then
animation2:Play()
hum.WalkSpeed = 5
elseif bool == "Stop" then
animation2:Stop()
hum.WalkSpeed = originalwalkspeed
end
end)
