Help with using tool, only functioning in single-player test for just me

ok so im trying to run a remote event from a tool’s localscript to the server
the server-side code:

local debounce = {}
local repl = game:GetService("ReplicatedStorage")
local track

repl.Use.OnServerEvent:Connect(function(plr)
    local char = plr.Character or plr.CharacterAdded:Wait()
    local item = char:FindFirstChildOfClass("Tool")
    if plr and not debounce[plr] then
        debounce[plr] = plr
        track = char.Humanoid:LoadAnimation(repl.Anims.Shake)
        track:Play()

        local sound = char[item.Name].Handle.Sound
        sound:Play()

        plr.playerstats.Coins.Value+=1

        track.Stopped:Wait()
        debounce[plr] = nil
    end
end)

but it only works properly in single-player studio test for just me for some reason, and only for me not my friend or team-test for both of us or playing the game on its games page for either of us.
for when it doesn’t work, it only plays the sound and nothing else works.
the remote event still runs through even when it doesn’t work, i logged it and it still worked.

for some reason there are still no errors either which is strange

Is it a group game? If so, the animation might be uploaded to your profile. Instead, upload the animation to the group.

1 Like

Did you mean to put leaderstats instead of playerstats?

1 Like

I have leaderstats connected with a while wait() loop that pretty much mirrors it but it’s a string value instead of an int value so i can add abbreviations.

yes it is a group game but i would think the other parts of the script would work.

nevermind it worked thank you so much bro

1 Like

Sorry this reply is late. You’re welcome!