local load = false
local x = 0
script.Parent.MouseButton1Down:Connect(function()
	
	
	local plr = script.Parent.Parent.Parent.Parent.Parent.Parent.Parent
		for i,v in pairs(plr:WaitForChild("Pets"):GetChildren())do
			for i=1,1 do 
				if load == false then
					load = true
					for f,g in pairs(script.Parent.Parent.Parent.Parent:WaitForChild("Items1"):GetChildren())do
						if g.Name == script.Parent.Parent.Name then
							x=x+1
						end
				
					
					end
					
					
						if v.Value >  x then
							local a = Instance.new("StringValue")
							a.Name = script.Parent.Parent.Name
							local SP = game.ReplicatedStorage:WaitForChild("Pets")
							local ff = SP:WaitForChild(script.Parent.Parent.Name) 
							a.Value = ff:WaitForChild("Icon").Value	
							a.Parent = script.Parent.Parent.Parent.Parent:WaitForChild("Items1")
							
						end
					end 
				end
			end
		load = false
	x=0
end)



2 comments

0

server? isn't this a client script?

0

Its a server script and mousebuttonclick still works