Pet Store Script - Couple of questions

Hi,

I’ve found a Open-Source Pet-Shop Script. However, the original creator is unknown, so there’s nowhere to go for questions.

So, i hope y’all can help me out.

Let me paste the scripts here first.

Save1

Datastore Shop
local Settings = require(game.ServerScriptService:WaitForChild("SettingS"))
local DataStore = game:GetService("DataStoreService")
game.Players.PlayerAdded:Connect(function(player)
	wait()
	local folder = Instance.new("Folder",player)
		folder.Name = "PetSave"
	for i,v in pairs(game.Workspace.PetShop.Parts:GetChildren()) do
		local data = DataStore:GetDataStore(v.Name)
		local bool = Instance.new("BoolValue", folder)
		bool.Name = v.Name
		bool.Value = data:GetAsync(player.UserId) or false
	end
end)

The script above is named ‘Datastore [Shop]’

Equipped
local Settings = require(game.ServerScriptService.SettingS)

local DataStore = game:GetService("DataStoreService")

local data = DataStore:GetDataStore("EQUIPeDd") --EQUIPeDd

game.Players.PlayerAdded:Connect(function(player)

local f = Instance.new("Folder",player)

f.Name = "PetShop"

local a = Instance.new("StringValue")

a.Name = "Equipped"

a.Parent = f

a.Value = data:GetAsync(player.UserId) or game.Workspace.PetShop.Parts.Model1.ItemName.Value

end)

game.Players.PlayerRemoving:Connect(function(player)

data:SetAsync(player.UserId, player.PetShop.Equipped.Value)

end)

The script above is inside script ‘Datastore [Shop]’, and is named ‘Equipped’

Give Pet
local Settings = require(game.ServerScriptService:WaitForChild("SettingS"))
local Found = false
--Give player when join

wait()
game.Players.PlayerAdded:Connect(function(player)
	player.CharacterAdded:Connect(function(character)
		local equipped = player:WaitForChild("PetShop").Equipped
		if equipped.Value ~= "" then
			local a = game.ServerStorage.Pets[equipped.Value]:Clone()
			if a then
				a.Name = "Pet"
				a.Parent = character
			elseif not a then
				equipped.Value = ""
			end
		else
			wait()
			--local a = game.ServerStorage.Pets[equipped.Value]:Clone()
			--if a then
			--	a.Name = "Pet"
			--	a.Parent = character
			--elseif not a then
			--	equipped.Value = ""
			--end
		end
		
		
		
		
			--Give player when buy
			player:WaitForChild("PetShop").Equipped.Changed:Connect(function()
			if character:FindFirstChild("Pet") then
				character.Pet:Remove()
				wait()
				local a = game.ServerStorage.Pets[equipped.Value]:Clone()
				a.Name = "Pet"
				a.Parent = character
			end
		end)
	end)
end)

The script above is named ‘Give Pet’

So what’s wrong?

Well, this!

Once a new player joins a game for their first time. The script gives them 1 pet for free. Which i don’t want. However, i can not find where in the script it does so.

Beside that, if i use some plugins, i can not find the DataStore?

Anyone in here who can find out where new players are rewarded a pet for free?

I really don’t see where the pet is given. Would you mind showing us the equipped script that’s parented to the DataStore

that’s already in the post. It’s the second script in the post :stuck_out_tongue:

Can you show me the ones you haven’t posted? None of these seem ui have your issue

1 Like

Check the string value of “Equipped” by testing the place in studio. I have no idea what the workspace PetShop model is, but it seems like a.Value sets it to that Model1.ItemName if there is no data.

local a = Instance.new("StringValue")

a.Name = "Equipped"

a.Parent = f

a.Value = data:GetAsync(player.UserId) or game.Workspace.PetShop.Parts.Model1.ItemName.Value
1 Like