my friend tested my sword fighting game and he couldn’t see the animations meanwhile i can see both but when i played with someone else he said they worked. this problem appeared so many times i’m afraid of making animations since they don’t work on other players.
here is a screenshot of the sword stuff
this is the script:
local tool = script.Parent
local idleAnim = script:WaitForChild("Idle")
local idleAnimTrack
local swingAnim = script:WaitForChild("Swing")
local swingAnimTrack
local slashSound = script:WaitForChild("SlashSound")
local sheathSound = script:WaitForChild("SheathSound")
local hitSound = script:WaitForChild("HitSound")
local hitCharacters = {}
local debounce = false
tool.Equipped:Connect(function()
local humanoid = script.Parent.Parent.Humanoid
if not idleAnimTrack then idleAnimTrack = humanoid:LoadAnimation(idleAnim) end
idleAnimTrack:Play()
sheathSound:Play()
end)
tool.Unequipped:Connect(function()
if idleAnimTrack then idleAnimTrack:Stop() end
if swingAnimTrack then swingAnimTrack:Stop() end
sheathSound:Play()
end)
tool.Activated:Connect(function()
if debounce then return end
debounce = true
local humanoid = script.Parent.Parent.Humanoid
if not swingAnimTrack then swingAnimTrack = humanoid:LoadAnimation(swingAnim) end
swingAnimTrack:Play()
wait(0.5)
slashSound:Play()
wait(0.5)
debounce = false
end)
tool.Blade.Touched:Connect(function(touch)
if hitCharacters[touch.Parent] or not debounce then return end
if touch.Parent:FindFirstChild("Humanoid") then
if touch.Name == "Head" then
touch.Parent.Humanoid:TakeDamage(45)
else
touch.Parent.Humanoid:TakeDamage(40)
end
hitSound:Play()
hitCharacters[touch.Parent] = true
wait(0.3)
hitCharacters[touch.Parent] = nil
end
end)
i will be very very very grateful if you could help me
Animations should be handled by a localscript, however:
If an animator is a descendant of a Humanoid or AnimationController in a Player’s Character then animations started on that Player’s client will be replicated to the server and other clients. If the animator is not a descendant of a player character, its animations must be loaded and started on the server to replicate.
In order to get help you will need to edit your topic so people could see it correct.
This is a text font made for scripts
Redo your topic in a correct way first.
Anyway, as @Syclya said. A tool can have a LocalScript and a ServerScript inside.
Local Scripts are used (in tool conditions), to play animations that can be seen by everyone, to play sounds that can be heard by the client only, to generate particles visible only by the client.
Server Scripts, however, are used for events that can be seen both by the client having the tool, and a different player. Here you can use sounds, particles and even animations if you do want to have a duo animation with a different player (dancing with the other one at the same time).
Use a Local Script to play the server-side animation. In the same format, use a Server Script to play any sounds, particles, etc.
Here is an example of a tool which has an animation , sound and particles. Since it is a LocalScript, other players will be able to see only your animations of the tool, not the sound and the particles generated by it. FireExtinguisher.rbxm (7.3 KB)
okay, i already edited the script btw
edit: i just checked the fire tool you sended and i saw it has the server script i will put that script in the sword and change the script i already have in a local script
hmm uh really weird the other swords also work without those scripts but my friend told me he doesn’t see them ;-; i just tested with my alt on 2 devices. anyways this is helpful for my other game that is currently 1 player only because this problem. thanks a bunch for the explanation!