local game = game local players = game:GetService("Players") local localPlayer = players.LocalPlayer local replicatedStorage = game:GetService("ReplicatedStorage") local runService = game:GetService("RunService") local target = nil local distance = 35 runService.RenderStepped:Connect(function() local beyblade = workspace.Beyblades:FindFirstChild(localPlayer.Name) distance = 35 if beyblade then for _,v in workspace.Training:GetChildren() do if v:FindFirstChild("Root") and v:GetAttribute("Health") > 0 and (beyblade.HumanoidRootPart.CFrame.Position - v.Root.CFrame.Position).Magnitude < distance then distance = (beyblade.HumanoidRootPart.CFrame.Position - v.Root.CFrame.Position).Magnitude target = v end end for _,v in workspace.Beyblades:GetChildren() do if v.Name ~= localPlayer.Name and v:FindFirstChild("HumanoidRootPart") and (beyblade.HumanoidRootPart.CFrame.Position - v.HumanoidRootPart.CFrame.Position).Magnitude < distance then target = v end end if target then replicatedStorage.Events.Attack:FireServer(beyblade,target,1,Vector3.new(0,0,0)) end end end)