Help with buy bug

Hello, so I have recently been bug testing and came across that you can only buy 1 item and the rest of the time it prints “hello”, instead of buy everything else. Am I using the datastores wrong or why can only you only buy it 1 time with multiple people in the server?

Server Script

local DataStore = game:GetService("DataStoreService"):GetDataStore("ShopHandlerDataNew")

game.ReplicatedStorage.ToolEvents.VIP.Carpet.OnServerEvent:Connect(function(player)
	if DataStore:GetAsync("Carpet") then
		print("Hello")
	else
		print("Bought")
		DataStore:SetAsync("Carpet", "True")
		print("Turned Bool True")
		game.ServerStorage.Tools.VIP.MagicCarpet:Clone().Parent = player.Backpack
		game.ReplicatedStorage.ToolEvents.VIPCheck.Carpet:FireClient(player)
	end
end)

game.ReplicatedStorage.ToolEvents.VIP.Boombox.OnServerEvent:Connect(function(player)
	if DataStore:GetAsync("Boomboxx") then
		print("Hello")
	else
		print("Bought")
		DataStore:SetAsync("Boomboxx", "True")
		print("Turned Bool True")
		game.ServerStorage.Tools.VIP.BoomBox:Clone().Parent = player.Backpack
		game.ReplicatedStorage.ToolEvents.VIPCheck.Boombox:FireClient(player)
	end
end)

game.ReplicatedStorage.ToolEvents.VIP.Taser.OnServerEvent:Connect(function(player)
	if DataStore:GetAsync("Taser") then
		print("Hello")
	else
		print("Bought")
		DataStore:SetAsync("Taser", "True")
		print("Turned Bool True")
		game.ServerStorage.Tools.VIP.Taser:Clone().Parent = player.Backpack
		game.ReplicatedStorage.ToolEvents.VIPCheck.Taser:FireClient(player)
	end
end)

Local Script

if MagicCarpet then
	script.Parent.VIPFrame.MagicCarpet.Purchase.CostText.Text = "Owned"
else
	script.Parent.VIPFrame.MagicCarpet.Purchase.CostText.Text = "VIP"
end

script.Parent.VIPFrame.MagicCarpet.Purchase.MouseButton1Click:Connect(function()

	if Mps:UserOwnsGamePassAsync(player.UserId, 180164478) then
		game.ReplicatedStorage.ToolEvents.VIP.Carpet:FireServer()
		script.Parent.VIPFrame.MagicCarpet.Purchase.CostText.Text = "Owned"
	else
		Mps:PromptGamePassPurchase(player, 180164478)
	end
end)

game.ReplicatedStorage.ToolEvents.VIPCheck.Carpet.OnClientEvent:Connect(function()
	script.Parent.VIPFrame.MagicCarpet.Purchase.CostText.Text = "Owned"
end)



if Boombox then
	script.Parent.VIPFrame.Boombox.Purchase.CostText.Text = "Owned"
else
	script.Parent.VIPFrame.Boombox.Purchase.CostText.Text = "VIP"
end

script.Parent.VIPFrame.Boombox.Purchase.MouseButton1Click:Connect(function()

	if Mps:UserOwnsGamePassAsync(player.UserId, 180164478) then
		game.ReplicatedStorage.ToolEvents.VIP.Boombox:FireServer()
		script.Parent.VIPFrame.Boombox.Purchase.CostText.Text = "Owned"
	else
		Mps:PromptGamePassPurchase(player, 180164478)
	end
end)

game.ReplicatedStorage.ToolEvents.VIPCheck.Boombox.OnClientEvent:Connect(function()
	script.Parent.VIPFrame.Boombox.Purchase.CostText.Text = "Owned"
end)



if Taser then
	script.Parent.VIPFrame.Taser.Purchase.CostText.Text = "Owned"
else
	script.Parent.VIPFrame.Taser.Purchase.CostText.Text = "VIP"
end

script.Parent.VIPFrame.Taser.Purchase.MouseButton1Click:Connect(function()

	if Mps:UserOwnsGamePassAsync(player.UserId, 180164478) then
		game.ReplicatedStorage.ToolEvents.VIP.Taser:FireServer()
		script.Parent.VIPFrame.Taser.Purchase.CostText.Text = "Owned"
	else
		Mps:PromptGamePassPurchase(player, 180164478)
	end
end)

Example with the other code I have. Person owns the turtle, I cant buy the turtle, he doesnt own the monkey, I can buy the monkey. https://gyazo.com/08847271062137a3465ceae12d6b177e

You need to create an individual key for every player…

You can append player.UserId to each key, for example,
DataStore:GetAsync("Carpet"..player.UserId)

Sweet it works thank you so much!

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.