So theres many issues i can’t fix by myself because of lack of knowledge about Lua and roblox studio, the first error i have:
How can i use an animation so i can make the players colission smaller (local animation, not an asset id, locally in the ServerStorage)
Second error is:
How to make a toggle system for my script
Third error is:
Why if i have an statement where the running function is activated you can’t crouch but it doesnt work
Fourth error is:
Why if i got LeftCtrl and C for crouching only one of them works
Issues explained i paste the code i created
local UserImputService = game:GetService("UserInputService")
local jugador = game.Players.LocalPlayer
local Character = jugador.Character or jugador.CharacterAdded:Wait()
local humanoid = Character:WaitForChild("Humanoid")
local CamaraJugador = game.Workspace.CurrentCamera
local TweenService = game:GetService("TweenService")
local AnimacionAgachado = script.Agachado
local Fov = 70
local Corriendo = false
local Agachado = false
--Funcion de correr (mantener presionado)
UserImputService.InputBegan:Connect(function(Tecla)
if Tecla.KeyCode == Enum.KeyCode.LeftShift or Tecla.KeyCode == Enum.KeyCode.ButtonR2 and Agachado == false then
Corriendo = true
humanoid.WalkSpeed = 21
local FovCorrer = {FieldOfView = Fov+15}
local FovCorriendo = TweenService:Create(CamaraJugador,TweenInfo.new(1),FovCorrer)
FovCorriendo:Play()
end
end)
UserImputService.InputEnded:Connect(function(Tecla)
if Tecla.KeyCode == Enum.KeyCode.LeftShift or Tecla.KeyCode == Enum.KeyCode.ButtonR2 then
Corriendo = false
humanoid.WalkSpeed = 16
local FovCaminar = {FieldOfView = Fov-15}
local FovCaminando = TweenService:Create(CamaraJugador,TweenInfo.new(1),FovCaminar)
FovCaminando:Play()
end
end)
--funcion de agacharse (activar/desactivar)
UserImputService.InputBegan:Connect(function(Tecla)
if Tecla.KeyCode == Enum.KeyCode.LeftControl or Tecla.KeyCode == Enum.KeyCode.C or Tecla.KeyCode == Enum.KeyCode.ButtonB and Corriendo == false then
Agachado = true
humanoid.WalkSpeed = 11
local FovAgachado = {FieldOfView = Fov-10}
local FovAgachandose = TweenService:Create(CamaraJugador,TweenInfo.new(1),FovAgachado)
FovAgachandose:Play()
AnimacionAgachado:Play()
end
end)
Is spanish tho so if need helping to know what does something mean in english feel free to ask