Having troubles with this script. It makes my animation play when I press Q, but not to stop once I press Q again. The "script.Sitting.Value" already changes to true and false when you press, I checked that already and that's not the issue.

local animation = Instance.new("Animation")
animation.AnimationId = "http://www.roblox.com/Asset?id=3344732901"

local Player = game.Players.LocalPlayer
local Mouse =  Player:GetMouse()
local animTrack = nil
Mouse.KeyDown:connect(function(key)
    if key:lower() == "q" then
        local character = Player.Character
        animTrack = character:WaitForChild("Humanoid"):LoadAnimation(animation)
        if script.Sitting.Value == false then
        animTrack:Play()
        else animTrack:Stop()

        
    end
        
    end
end)

2 comments

0

Is this a local script or a server script?

0

Local script.