I've been stuck trying to fix this bug that when one player lets go of the X key all players forced to stand and stop charging how do I fix this?
script:
game.ReplicatedStorage.ChargeEvent.ChargeBegan.OnServerEvent:Connect(function(plr,KeyHeld)
local Toggles = plr.Toggles
local Sprint = Toggles.AntiSprint.Value
local Skill = Toggles.AntiSkill.Value
local skills =require(game.ServerScriptService.Skills)
local particle = game:GetService('ReplicatedStorage').Particles.Charge:Clone()
local Animation = Instance.new('Animation')
Animation.AnimationId = 'rbxassetid://4596083572'
local AnimTrack = plr.Character.Humanoid:LoadAnimation(Animation)
particle.Parent = plr.Character.PrimaryPart
while plr.leaderstats.Mana.Value <= plr.leaderstats.MaxMana.Value and not plr.Toggles.AntiCharge.Value and KeyHeld do
wait(.1)
plr.leaderstats.Mana.Value = plr.leaderstats.Mana.Value + plr.leaderstats.MaxMana.Value/100
plr.Character.Humanoid.WalkSpeed = 0
plr.Character.Humanoid.JumpPower = 0
AnimTrack:Play()
if plr.leaderstats.Mana.Value >= plr.leaderstats.MaxMana.Value then
plr.leaderstats.Mana.Value = plr.leaderstats.MaxMana.Value
end
game.ReplicatedStorage.ChargeEvent.ChargeEnd.OnServerEvent:Connect(function()
KeyHeld = false
end)
end
AnimTrack:Stop()
particle:Destroy()
plr.Character.Humanoid.WalkSpeed = 16
plr.Character.Humanoid.JumpPower = 50
end)

3 comments
Updating the leaderstats should be done on the server, the animations on the client. The charge end and charge began should be seperate functions. They should be in a local script.tbe only thing that should be on the server is the changing of the data/particles.
I think this might be the why you're having issues with the animation since you're handling it on the server
Thanks it works