Animation only working in solo game testing on studio

(I don’t know whether to label this as scripting or animations because I don’t know what causes this issue)

An animation for a katana is only working in solo testing in studio, or going in a team test and being the only player there. Once someone joins the team test, the animations cannot be seen by other players and stop working (for you) when you die. What I want is the animation for the sword to be seen for all players.

I believe it’s probably because it’s a LocalScript, but I’ve been stuck on this for a while and haven’t found a solution for this.
The animations are uploaded through my account and it’s a game me and 2 others are working on so that may also be the issue…?

local debounce = false
local tool = script.Parent
local player = game.Players.LocalPlayer
local char = player.Character or player.CharacterAdded:Wait()
local hum = char.Humanoid
local anim = hum:LoadAnimation(script.Parent.KatanaEquipAnim)
local attackanim = hum:LoadAnimation(script.Parent.UpdatedKatanaSwingAnim)
local mouse = player:GetMouse()

anim.Priority = Enum.AnimationPriority.Action
attackanim.Priority = Enum.AnimationPriority.Action



if debounce then return end

	if debounce == false then
		debounce = true
		print("sword hit")

		debounce = false

Why is your if debounce then return end supposed to do? It’s not inside any function.

Animations are played locally, then sent to the server so other players can see them.
If you game lags a lot they may never see the animations.

And what calls the script.parent.Activated function? What is being activated?

From the looks of it tool = script.parent (and yet you use script.parent instead of tool in a few other places in your script) so you have your animations loaded into the tool? From what I see you are loading the animation each time you run the functions: local anim = hum:LoadAnimation(script.Parent.KatanaEquipAnim)

If the script doesn’t have WaitForChild for some items it may error since things like the Player.LocalCharacter may not be loaded when the script starts.

1 Like

The if debounce then return I kept because the script still worked (even though I assume it’s not good and there’s a replacement)

The script’s messy, and I’m not particularly the best scripter so I’ll try fix it somehow.

Also I’ve researched the issue more and it’s because of the way I uploaded the animations, they’re meant to be uploaded to the group that’s linked to the game, not directly through my profile, so it doesn’t seem to be anything script related. But thanks for telling me about the errors in my script anyways.

people do that to abruptly end the current task. Idk why u do that when you can just do

if debounce == false then
--- code

and it’ll still do the same thing.

1 Like

Since the debounce is already taken care of in the last function it isn’t required at all between the functions. Debounces help inside functions to keep them from being spammed.
If you get rid of that line between the functions then it makes no difference.