I Was making some animations in my game and for some reason when you play them, no one sees them.
the animation is on Action priority
and I am the owner of all the animations and the game itself.
Only I can see the animations and no one else
how can I fix it?
Is it a local script or a server script? Can you show us the code for playing the animation?
I Used a local script instead of a server script and the script is in my latest discussion
Use a local script to get the name of the player and hai character and such stuff but you must use the server script to play the animation so that it is server wide and not locally playing in the player.
I didn’t quite understand what you said
Basically if you play the animations in a LocalScript they will only play for your client, so you should be playing the animation on a normal script
Yes but it wont play for them in their screen
If you play the animations on a server script I see no reason why other people wouldn’t see it
Heres the script (It is in a local script)
local lArm = character:WaitForChild("Left Arm") --local lArm = character:WaitForChild("Left Arm")
local torso = character:WaitForChild("Torso") --local torso = character:WaitForChild("Torso")
local remote = character:WaitForChild("RemoteEvent")
local animationTrack
local dmg = false
local d = true
local canPunch = false
--local debounce = os.clock(0.5)
lArm.Touched:Connect(function (hit)
if dmg then
local h = hit.Parent:FindFirstChildOfClass("Humanoid")
if h then
-- h:TakeDamage(20)
remote:FireServer(h, 20)
dmg = false
end
end
end)
input.InputBegan:Connect(function (key)
local f = key.KeyCode
if f == Enum.KeyCode.F then
print("E")
if d then
canPunch = true
d = false
dmg = true
animationTrack = humanoid:LoadAnimation(animation)
animationTrack:Play()
-- wait(0.5)
animationTrack.Stopped:Wait()
dmg = false
d = true
wait(2)
canPunch = false
end
end
end)
I made some scripts for what you’re trying to do.
Make a RemoteEvent in ReplicatedStorage called PunchEvent
Here’s the LocalScript (goes in StarterCharacter)
local UIS = game:GetService("UserInputService")
local Plr = game.Players.LocalPlayer
local D = false
UIS.InputBegan:Connect(function(Key, GPE)
if not GPE then
if Key.KeyCode == Enum.KeyCode.F then
if Plr.DoingAction and not Plr.DoingAction.Value then
if not D then
D = true
game.ReplicatedStorage.PunchEvent:FireServer()
wait(0.5)
D = false
end
end
end
end
end)
Here’s the server script (in serverscriptservice)
game.Players.PlayerAdded:Connect(function(Plr)
local Action = Instance.new("BoolValue")
Action.Name = "DoingAction"
Action.Parent = Plr
end)
local PunchAnimation = Instance.new("Animation")
PunchAnimation.AnimationId = "rbxassetid://your animation here"
game.ReplicatedStorage.PunchEvent.OnServerEvent:Connect(function(Plr)
if not Plr.DoingAction.Value then
local Hum = Plr.Character.Humanoid
if Hum.Health > 0 then
Plr.DoingAction.Value = true
Hum:LoadAnimation(PunchAnimation):Play()
wait(0.5)
Plr.DoingAction.Value = false
end
end
end)
Hope this helps