basically i have a flashlight, i dont use the backpack because it kinda looks ugly for me of course
so when the “equippedques” is set to true it should play the apropiate animations for equiping and moving it
if its set to false is should play the dequip animation but not play the walking animation when it is set to false
local animationwalk = script:WaitForChild("walk")
local animationidle = script:WaitForChild("idle")
local animationequip = script:WaitForChild("equip")
local animationdeqiup = script:WaitForChild("deqiup")
local flashlight = game.ReplicatedStorage.flashlight
local flashmodel = flashlight:Clone()
local flashprox = flashlight.ProximityPrompt
flashlight.Parent = workspace
local equippedques = false
local destroyflash = workspace:FindFirstChild("flashlight")
local viewhuman = game.Workspace.CurrentCamera:WaitForChild("viewmodel").Humanoid.Animator
local realhuman = script.Parent:WaitForChild("Humanoid")
local RunService = game:GetService("RunService")
local walking = viewhuman:LoadAnimation(animationwalk)
local idle = viewhuman:LoadAnimation(animationidle)
local equipped = viewhuman:LoadAnimation(animationequip)
local dequipped = viewhuman:LoadAnimation(animationdeqiup)
local isequipped = false
print("Walking Animation Loaded:", walking)
flashprox.Triggered:Connect(function()
flashlight:Destroy()
local userinput = game:GetService("UserInputService")
userinput.InputBegan:Connect(function(input, gameProcessedEvent)
if input.KeyCode == Enum.KeyCode.F and equippedques == false then
equippedques = true
equipped:Play()
idle:Play()
if equippedques == true then
realhuman.Running:Connect(function(movementSpeed)
if movementSpeed > 0 then
if not walking.IsPlaying then
print("Starting Walking Animation")
idle:Stop()
walking:Play()
end
else
if walking.IsPlaying then
print("Stopping Walking Animation")
walking:Stop()
idle:Play()
end
end
end)
end
elseif input.KeyCode == Enum.KeyCode.F and equippedques == true then
dequipped:Play()
if walking.IsPlaying then
walking:Stop()
end
if idle.IsPlaying then
idle:Stop()
end
equippedques = false
end
end)
end)
as you can see the walk thing should only play if its set to true
but its still playing even though its shouldnt
please explain why
(if you want you can modiy it to maybe improve it thanks!!)