Motor6d CurrentAngle LOCKED on client but not on server

When I increase the MaxVelocity, the object spins on the server, but not on the client.
I even made a local script event trying to do this on the client. Server and Client working here.

Solutions?

Server:

local ReplicatedStorage = game:GetService("ReplicatedStorage")
local TweenService = game:GetService("TweenService")

local events = ReplicatedStorage:WaitForChild("Events")
local animateTowerEvent = events:WaitForChild("AnimateTower")

local char = script.Parent.Parent
local config = char:WaitForChild("Config")

function FindTarget()
	local bestTarget = nil

	local bestWaypoing = nil
	local bestDistance = nil
	local bestHealth = nil
	local map = workspace.Map:FindFirstChildOfClass("Folder")

	for i, enemy in ipairs(workspace.Enemies:GetChildren()) do
		local distanceToEnemy = (enemy.HumanoidRootPart.Position-char.HumanoidRootPart.Position).Magnitude
		local distanceToWaypoint = (enemy.HumanoidRootPart.Position - map.Waypoints[enemy.MovingTo.Value].Position).Magnitude
		if enemy:FindFirstChild("isHidden") and not char:FindFirstChild("Config"):FindFirstChild("HiddenDetection") then

		else
			if distanceToEnemy <= config.Range.Value then
				if not enemy.Config.Hidden.Value or (config.HiddenDetection.Value) then
					if config.TargetMode.Value == "Near" then
						config.Range.Value = distanceToEnemy
						bestTarget = enemy
					elseif config.TargetMode.Value == "First" then
						if not bestWaypoing or enemy.MovingTo.Value >= bestWaypoing then
							bestWaypoing = enemy.MovingTo.Value

							if not bestDistance or distanceToWaypoint < bestDistance then
								bestDistance = distanceToWaypoint
								bestTarget = enemy
							end 
						end
					elseif config.TargetMode.Value == "Last" then
						if not bestWaypoing or enemy.MovingTo.Value <= bestWaypoing then
							bestWaypoing = enemy.MovingTo.Value

							if not bestDistance or distanceToWaypoint > bestDistance then
								bestDistance = distanceToWaypoint
								bestTarget = enemy
							end 
						end
					elseif config.TargetMode.Value == "Strong" then
						if not bestHealth or enemy.Humanoid.Health > bestHealth then
							bestHealth = enemy.Humanoid.Health
							bestTarget = enemy
						end
					elseif config.TargetMode.Value == "Weak" then
						if not bestHealth or enemy.Humanoid.Health < bestHealth then
							bestHealth = enemy.Humanoid.Health
							bestTarget = enemy
						end
					end
				end
			end
		end
	end
	return bestTarget
end

function StopSpin(Motor, newTower)
	local info = TweenInfo.new(
		2,
		Enum.EasingStyle.Sine,
		Enum.EasingDirection.In,
		0,
		false,
		0
	)

	local Goals = 
		{
			MaxVelocity = 0
		}
	local Goals2 = 
		{
			MaxVelocity = 0
		}

	local makeBarrelSpin = TweenService:Create(char.Weapon.Main.Barrel, info, Goals)
	local makeBarrelSpin2 = TweenService:Create(char.Weapon.Main["3"], info, Goals2)
	local makeBarrelSpin3 = TweenService:Create(char.Weapon.Main["4"], info, Goals2)

	while true do
		task.wait()
		--char.HumanoidRootPart.ChargeDown:Play()
		makeBarrelSpin:Play()
		makeBarrelSpin2:Play()
		makeBarrelSpin3:Play()
		break
	end
end

function Spin(Motor, newTower)
	local info = TweenInfo.new(
		2,
		Enum.EasingStyle.Sine,
		Enum.EasingDirection.In,
		0,
		false,
		0
	)

	local Goals = 
		{
			MaxVelocity = 0.4
		}
	local Goals2 = 
		{
			MaxVelocity = 0.9
		}

	local makeBarrelSpin = TweenService:Create(char.Weapon.Main.Barrel, info, Goals)
	local makeBarrelSpin2 = TweenService:Create(char.Weapon.Main["3"], info, Goals2)
	local makeBarrelSpin3 = TweenService:Create(char.Weapon.Main["4"], info, Goals2)

	while true do
		task.wait()
		makeBarrelSpin:Play()
		makeBarrelSpin2:Play()
		makeBarrelSpin3:Play()
		break
	end
end

local start = false
local play = false
local stop = true
local tan = tick()
local fireLoop = char.Animations:WaitForChild("FireLoop")
local chargeUp = char.Animations:WaitForChild("ChargeUp")

local fireLoopTrack = char.Humanoid.Animator:LoadAnimation(fireLoop)
local chargeUpTrack = char.Humanoid.Animator:LoadAnimation(chargeUp)

while wait(config.Cooldown.Value) do
	local timeSinceLastEnemy = tick() - tan
	if timeSinceLastEnemy >= 1.3 then
		tan = tick()
		StopSpin()
		char.HumanoidRootPart.ChargeUp:Stop()
		char.HumanoidRootPart.Boom:Stop()
		char.HumanoidRootPart.Loop:Stop()
		chargeUpTrack:Stop()
		fireLoopTrack:Stop()
		char.Weapon.ShootPart.Attachment0.ParticleEmitter.Enabled = false
		char.Weapon.ShootPart.Attachment0.ParticleEmitter2.Enabled = false
		char.Weapon.ShootPart.Beam1.Attachment1 = nil
		char.Weapon.ShootPart.Beam2.Attachment1 = nil
		char.Weapon.ShootPart.Beam3.Attachment1 = nil
		char.Weapon.ShootPart.Beam4.Attachment1 = nil
		start = false
		play = false
		stop = true
	end

	local target = FindTarget()
	if target and target.Parent then
		start = true
		if target:FindFirstChild("Torso") then
			local root = char.HumanoidRootPart
			local vector = Vector3.new(target.Torso.Position.X,root.Position.Y,target.Torso.Position.Z)
			char.HumanoidRootPart.CFrame = CFrame.new(root.Position,vector)
		end

		if not play then
			fireLoopTrack:Stop()
			play = true
			char.Weapon.ShootPart.Attachment0.ParticleEmitter.Enabled = true
			char.Weapon.ShootPart.Attachment0.ParticleEmitter2.Enabled = true
			char.Weapon.ShootPart.Beam1.Attachment1 = nil
			char.Weapon.ShootPart.Beam2.Attachment1 = nil
			char.Weapon.ShootPart.Beam3.Attachment1 = nil
			char.Weapon.ShootPart.Beam4.Attachment1 = nil
			animateTowerEvent:FireAllClients(char, _, _,true,char.Weapon.Main["3"].CurrentAngle)
			Spin()
			char.HumanoidRootPart.ChargeDown:Stop()
			chargeUpTrack:Play()
			--char.HumanoidRootPart.WindUp:Play()			
			chargeUpTrack:Play()
			char.HumanoidRootPart.ChargeUp:Play()
			chargeUpTrack.Stopped:Wait()
			char.HumanoidRootPart.ChargeUp:Stop()
			char.HumanoidRootPart.Boom:Play()
			char.HumanoidRootPart.Loop:Play()
			fireLoopTrack:Play()
		end
		if target:FindFirstChild("Humanoid") then
			target.Humanoid:TakeDamage(config.Damage.Value)
			char.Weapon.ShootPart.Beam1.Attachment1 = target.HumanoidRootPart:FindFirstChildOfClass("Attachment")
			char.Weapon.ShootPart.Beam2.Attachment1 = target.HumanoidRootPart:FindFirstChildOfClass("Attachment")
			char.Weapon.ShootPart.Beam3.Attachment1 = target.HumanoidRootPart:FindFirstChildOfClass("Attachment")
			char.Weapon.ShootPart.Beam4.Attachment1 = target.HumanoidRootPart:FindFirstChildOfClass("Attachment")
		end
		tan = tick()
	else
		char.Weapon.ShootPart.Beam1.Attachment1 = nil
		char.Weapon.ShootPart.Beam2.Attachment1 = nil
		char.Weapon.ShootPart.Beam3.Attachment1 = nil
		char.Weapon.ShootPart.Beam4.Attachment1 = nil
	end	
end

Client:

animateTowerEvent.OnClientEvent:Connect(function(tower, animName, target,yes,maxdeirenomaxnononobutcurrent)
	if not yes then
		playAnimation(tower, animName)
		if target then
			fireProjectile(tower,target)
		end
	else
		local info = TweenInfo.new(
			2,
			Enum.EasingStyle.Sine,
			Enum.EasingDirection.In,
			0,
			false,
			0
		)

		local Goals2 = 
			{
				MaxVelocity = 0.9
			}

		local makeBarrelSpin2 = TweenService:Create(tower.Weapon.Main["3"], info, Goals2)
		local makeBarrelSpin3 = TweenService:Create(tower.Weapon.Main["4"], info, Goals2)
		makeBarrelSpin2:Play()
		makeBarrelSpin3:Play()

		tower.Weapon.Main["3"].DesiredAngle = math.huge
		tower.Weapon.Main["4"].DesiredAngle = math.huge
	end
end)

All help appreciated, thank you.

1 Like