I have a server script that is supposed to stop playing a animation on both the server and the local player part. However when i just up it only stops on the local player side but keeps the animation playing for the server. Is there a away to fix this so that he also stops on the server side too?
local Seat = script.Parent.Parent.Seat
local Animation = script.Parent.Parent.Animation
local ClickDet = script.Parent.ClickDetector
local working = false
local BodyPart = "Arm"
local Strenghtoaffect = BodyPart.."Strengh"
local Staminatoaffect = "MaxStamina"
local Weighttoaffect = "Weight"
local Strenghamounttoaffect = .001
local Staminaamounttoaffect = .001
local Weightamounttoaffect = .01
local WorkoutRepSpeed = 2
local Debounce = 0
local animationTrack
local IsDoingAction
function WorkoutInjury(Player)
print("workoutrepinjury")
Player.stats.CharacterStats.IsInjured.Value = true
Player.stats.CharacterStats.MaxStamina.Stamina.Value = 0
Player.stats.CharacterStats.IsInjured.LeftArm.Value = true
Player.stats.CharacterStats.IsInjured.RightArm.Value = true
working = false
end
ClickDet.MouseClick:Connect(function(Player)
if Player.stats.CharacterStats.IsDoingAction.Value == false and Player.stats.CharacterStats.IsInjured.Value == false and Player.stats.CharacterStats.MaxStamina.Stamina.Value >= 10 then
Debounce = 0
Seat.Disabled = false
ClickDet.MaxActivationDistance = 0
print(Player.Character.Humanoid)
Seat:Sit(Player.Character.Humanoid)
local hum = Player.Character.Humanoid
IsDoingAction = Player.stats.CharacterStats.IsDoingAction
IsDoingAction.Value = true
if working == false then
if Seat.Occupant == Player.Character.Humanoid then
local humanoid = Seat.Occupant
working = true
while Seat.Occupant == Player.Character.Humanoid and Player.stats.CharacterStats.MaxStamina.Stamina.Value > 0 do
animationTrack = Player.Character.Humanoid:LoadAnimation(Animation)
animationTrack:Play()
wait(1)
if 1 > math.random(1,Player.stats.CharacterStats[Strenghtoaffect].Value * 2 + Player.stats.CharacterStats.MaxStamina.Stamina.Value / 2) then
print(WorkoutInjury)
WorkoutInjury(Player)
end
Player.stats.CharacterStats.MaxStamina.Stamina.Value = Player.stats.CharacterStats.MaxStamina.Stamina.Value - 4
Player.stats.CharacterStats[Strenghtoaffect].Value = Player.stats.CharacterStats[Strenghtoaffect].Value + Strenghamounttoaffect
Player.stats.CharacterStats[Staminatoaffect].Value = Player.stats.CharacterStats[Staminatoaffect].Value + Staminaamounttoaffect
Player.stats.CharacterStats[Weighttoaffect].Value = Player.stats.CharacterStats[Weighttoaffect].Value + Weightamounttoaffect
end
end
end
end
end)
Seat.Changed:Connect(function(Occupant)
if working == true and Debounce == 0 then
print("Stopped")
Debounce = 1
print(Occupant)
Seat.Disabled = true
IsDoingAction.Value = false
animationTrack:Stop()
working = false
wait(2)
animationTrack:Stop()
print("Complete stop")
animationTrack:Destroy()
ClickDet.MaxActivationDistance = 7
end
end)
Thank you for any help I really appreciate that this site even exist

2 comments
Mouse click only changes values on the client. Use a remote event to change it.
This is a server script not a local script, not sure why it wont change even there.