well, my problem is not about any error in the output, but rather the part of the script that should detect the false of the boolValue. Good If it changes from true to false, the only part that works is the true part, in the false part it simply does not deactivate the animation.
Line 55 to 58.
local Player = game.Players.LocalPlayer
local Character = Player.Character
local uis = game:GetService("UserInputService")
local crawlAnimation = Character:WaitForChild("CrouchService"):WaitForChild("Crouch")
local loadedCrawlAnim
local crawlIdle = Character:WaitForChild("CrouchService"):WaitForChild("Idle")
local loadedIdleAnim
local isCrawling = false
local humanoid = Character:FindFirstChild("Humanoid")
local WalkSpeed = Player.PlayerGui:WaitForChild("Configuracion"):WaitForChild("WalkSpeed").Value
local Value = Player:WaitForChild("ControlConfg"):WaitForChild("Crouch")
Player.PlayerGui.Configuracion:WaitForChild("WalkSpeed"):GetPropertyChangedSignal("Value"):Connect(function()
WalkSpeed = Player.PlayerGui.Configuracion:WaitForChild("WalkSpeed").Value
end)
Player.ControlConfg:WaitForChild("Crouch"):GetPropertyChangedSignal("Value"):Connect(function()
Value.Value = Player.ControlConfg:WaitForChild("Crouch").Value
end)
local tweenInfo = TweenInfo.new(0.3)
local TweenService = game:GetService("TweenService")
local tweenPlay = TweenService:Create(humanoid, tweenInfo, {CameraOffset = Vector3.new(0, -0.5, 0)})
local tweenStop = TweenService:Create(humanoid, tweenInfo, {CameraOffset = Vector3.new(0, 0, 0)})
local KeyText = "C"
local isCrawling = false
local KeyPressedTimestamp = 0
local AgacharseKey = Player:WaitForChild("Keys"):WaitForChild("AgacharseKey")
AgacharseKey:GetPropertyChangedSignal("Value"):Connect(function()
KeyText = AgacharseKey.Value
end)
uis.InputBegan:Connect(function(key)
if key.KeyCode.Name == KeyText then
KeyPressedTimestamp = tick()
script.Parent.BoolValue.Value = true
uis.InputEnded:Connect(function(key)
if key.KeyCode.Name == KeyText then
script.Parent.BoolValue.Value = false
end
end)
end
end)
script.Parent.BoolValue:GetPropertyChangedSignal("Value"):Connect(function()
if script.Parent.BoolValue.Value == true then
isCrawling = true
loadedIdleAnim = humanoid:LoadAnimation(crawlIdle)
loadedIdleAnim:Play()
tweenPlay:Play()
elseif loadedCrawlAnim then
isCrawling = false
loadedCrawlAnim:Stop()
loadedIdleAnim:Stop()
tweenStop:Play()
end
end)
game:GetService("RunService").RenderStepped:Connect(function()
if not isCrawling then return end
if humanoid.MoveDirection.Magnitude > 0 then
if not loadedCrawlAnim then loadedCrawlAnim = humanoid:LoadAnimation(crawlAnimation) end
if loadedCrawlAnim.IsPlaying == false then loadedCrawlAnim:Play() end
else
if loadedCrawlAnim ~= nil then
loadedCrawlAnim:Stop()
end
loadedIdleAnim:Play()
end
end)