if Player then while wait()do if Player.Character:FindFirstChild("\072\117\109\097\110\111\105\100\082\111\111\116\080\097\114\116")then local I=script.Parent.Pos.Value local n=script.Parent.CoinPos.Value local M=script.Parent.BodyGyro local w=script.Parent.BodyPosition local P=Player.Character.HumanoidRootPart.Position.Y-script.Parent.Position.Y if script.Parent.Selected.Value==0 then local n=require((game.ReplicatedStorage.Assets.Pets:FindFirstChild(script.Parent.PetName.Value))["\080\101\116 \068\097\116\097"])if n.fly==true then w.Position=(((Player.Character.HumanoidRootPart.Position+I)-Vector3.new(0,2,0))+Vector3.new(0,script.Parent.Size.Y/2,0))+Vector3.new(0,game.ServerScriptService.globalPetFloat.Value,0)if Player.Walking.Value==false then M.CFrame=CFrame.new(script.Parent.Position,Player.Character.HumanoidRootPart.Position-Vector3.new(0,P,0))else M.CFrame=Player.Character.HumanoidRootPart.CFrame end else w.Position=((Player.Character.HumanoidRootPart.Position+I)-Vector3.new(0,3.4,0))+Vector3.new(0,script.Parent.Size.Y/2,0)if Player.Walking.Value==false then M.CFrame=CFrame.new(script.Parent.Position,Player.Character.HumanoidRootPart.Position-Vector3.new(0,P,0))else M.CFrame=Player.Character.HumanoidRootPart.CFrame end end else w.Position=((workspace.CoinFolder[script.Parent.Selected.Value].Position+n)-Vector3.new(0,workspace.CoinFolder[script.Parent.Selected.Value].Size.Y/2,0))+Vector3.new(0,script.Parent.Size.Y/2,0)M.CFrame=CFrame.new(script.Parent.Position,workspace.CoinFolder[script.Parent.Selected.Value].Position-Vector3.new(0,0,0))end end end end


if Player then
	while wait() do
		if Player.Character:FindFirstChild("HumanoidRootPart") then
			local Pos = script.Parent.Pos.Value
			local CoinPos = script.Parent.CoinPos.Value
			local BG = script.Parent.BodyGyro
			local BP = script.Parent.BodyPosition
			local d = Player.Character.HumanoidRootPart.Position.Y - script.Parent.Position.Y
			if script.Parent.Selected.Value == 0 then
				local Stats = require(game.ReplicatedStorage.Assets.Pets:FindFirstChild(script.Parent.PetName.Value)["Pet Data"])
				if Stats.fly == true then
					BP.Position = (Player.Character.HumanoidRootPart.Position + Pos) - Vector3.new(0,2,0) + Vector3.new(0,script.Parent.Size.Y/2,0) + Vector3.new(0, game.ServerScriptService.globalPetFloat.Value, 0)
					if Player.Walking.Value == false then
						BG.CFrame = CFrame.new(script.Parent.Position, Player.Character.HumanoidRootPart.Position - Vector3.new(0, d, 0))
					else
						BG.CFrame = Player.Character.HumanoidRootPart.CFrame
					end
				else
					BP.Position = (Player.Character.HumanoidRootPart.Position + Pos) - Vector3.new(0,3.4,0) + Vector3.new(0,script.Parent.Size.Y/2,0)
					if Player.Walking.Value == false then
						BG.CFrame = CFrame.new(script.Parent.Position, Player.Character.HumanoidRootPart.Position - Vector3.new(0, d, 0))
					else
						BG.CFrame = Player.Character.HumanoidRootPart.CFrame
					end
				end
			else
				BP.Position = (workspace.CoinFolder[script.Parent.Selected.Value].Position + CoinPos) - Vector3.new(0,workspace.CoinFolder[script.Parent.Selected.Value].Size.Y/2,0) + Vector3.new(0,script.Parent.Size.Y/2,0)
				BG.CFrame = CFrame.new(script.Parent.Position, workspace.CoinFolder[script.Parent.Selected.Value].Position - Vector3.new(0, 0, 0))
			end
		end
	end
end
