I am trying to animate specific players in my game with an animation GUI. I want to be able to control other players' animations with only my GUI. When I click the animation button on the GUI it doesn't play, but when they click it, it plays. I think it has something to do with the local parts of the script but I'm unsure..

wait(1)
local frame=script.Parent
local user=game.Players.xoisi -- player name
repeat wait() until user.Character local char=user.Character
local humanoid=char:WaitForChild("Humanoid")
local anim
function playanim(id)
	if char~=nil and humanoid~=nil then
		local id="rbxassetid://"..tostring(id)
		local oldanim=char:FindFirstChild("LocalAnimation")
		if anim~=nil then
			anim:Stop()
		end
		if oldanim~=nil then
			if oldanim.AnimationId==id then
				oldanim:Destroy()
				return
			end
			oldanim:Destroy()
		
		end
		local animation=Instance.new("Animation",char)
		animation.Name="LocalAnimation"
		animation.AnimationId=id
		anim=humanoid:LoadAnimation(animation)
		anim:Play()
	end
end
local b1=frame.HighNote
b1.MouseButton1Down:connect(function() playanim(b1.AnimID.Value) end)
local b1=frame.HighNoteII
b1.MouseButton1Down:connect(function() playanim(b1.AnimID.Value) end)
local b1=frame.Singing
b1.MouseButton1Down:connect(function() playanim(b1.AnimID.Value) end)
local b1=frame.SingingLoop
b1.MouseButton1Down:connect(function() playanim(b1.AnimID.Value) end)
local b1=frame.Dance
b1.MouseButton1Down:connect(function() playanim(b1.AnimID.Value) end)
local b1=frame.Dance2
b1.MouseButton1Down:connect(function() playanim(b1.AnimID.Value) end)
local b1=frame.Dance3
b1.MouseButton1Down:connect(function() playanim(b1.AnimID.Value) end)
local b1=frame.Wave
b1.MouseButton1Down:connect(function() playanim(b1.AnimID.Value) end)
local b1=frame.Cheer
b1.MouseButton1Down:connect(function() playanim(b1.AnimID.Value) end)
local b1=frame.WalkSing
b1.MouseButton1Down:connect(function() playanim(b1.AnimID.Value) end)
local b1=frame.BabyIDanceBreak
b1.MouseButton1Down:connect(function() playanim(b1.AnimID.Value) end)
local b1=frame.BabyIDanceBreakII
b1.MouseButton1Down:connect(function() playanim(b1.AnimID.Value) end)
local b1=frame.Crouch
b1.MouseButton1Down:connect(function() playanim(b1.AnimID.Value) end)




This is the script I'm using