in the roblox studio my animation button working good but in the actual game its not working for some reason. i hope get it fixed
studio footage:
https://gyazo.com/bfee14d33843bfce895b5a8411336993
acual game footage:
https://gyazo.com/92a7b330399fa4db2df57feb8ab8118b
my button local script:
--sit
local Debounce = false
local userinputservice = game:GetService("UserInputService")
script.Parent.MouseButton1Click:Connect(function()
local animation = script.Parent:FindFirstChild("Sit")
--animation.AnimationId = "rbxassetid://11164244801"
local player = game.Players.LocalPlayer
local human = player.Character:FindFirstChild("Humanoid")
local player = game.Players.LocalPlayer
local Animator = human:FindFirstChild("Animator")
local playAnim = Animator:LoadAnimation(animation)
for i,v in pairs(human:GetPlayingAnimationTracks()) do
--human.Parent:FindFirstChild("HumanoidRootPart").Anchored = false
v:Stop()
end
if Debounce == false then
Debounce = true
playAnim:Play()
wait(1)
--player.Character:FindFirstChild("HumanoidRootPart").Anchored = true
userinputservice.InputBegan:Connect(function(key,chatted)
if (not chatted) then
if key.KeyCode == Enum.KeyCode.Space then
--player.Character:FindFirstChild("HumanoidRootPart").Anchored = false
playAnim:Stop()
end
end
end)
wait(0.5)
Debounce = false
end
end)