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)
COMMUNITY QUESTION
Im trying to make a pet trade button but it only works every so often in roblox studio?
0 answers
No public answers were preserved for this question.
This discussion is preserved as it was. New answers, comments, and votes are closed.

2 comments
server? isn't this a client script?
Its a server script and mousebuttonclick still works