I do know for a bit about filteringenabled and the purpose of using it. But is this the best way of using them in terms of securing the shop?

This is the event setup script(serverscript)

-- Services
local theRS = game:GetService("ReplicatedStorage")

-- eventsFolder
local theEventsFolder = theRS:WaitForChild("EventsFolder")

-- remoteevents
local CPurchase = theEventsFolder:WaitForChild("CoinsPurchase")
local GPurchase = theEventsFolder:WaitForChild("GemsPurchase")
local OwnedItem = theEventsFolder:WaitForChild("OwnedItem")
local Affordable = theEventsFolder:WaitForChild("Affordable")

-- ItemOwned Check 
local BItemsFolder = game.ServerStorage.BoughtItems
local SelectedItem = game.StarterGui.Navigations.ShopFrame.ShopPreviewFrame.ItemNameview



-- The coins purchase
CPurchase.OnServerEvent:Connect(function(Player, Value, Amount)
	if Player.leaderstats.Coins.Value >= Amount then
		print("Enough coins for purchase")
		Player.leaderstats.Coins.Value = Player.leaderstats.Coins.Value - Amount
		print(Value)
	else
		print("Insufficient coins! Cannot purchase!")
	end
end)

-- Check if item's owned
OwnedItem.OnServerEvent:Connect(function(Player, Value, Amount)
	if BItemsFolder:FindFirstChild(SelectedItem.Text) then
		print("Item is Owned")
	else
		print("Item isn't owned yet")
	end
end)

-- See if item's affordable or not 
Affordable.OnServerEvent:Connect(function(Player, Value, Amount)
	if Player.leaderstats.Coins.Value >= Amount then
		print("Item's Affordable")
	else
		print("Item's not affordable")
	end
end)

And this is the Client script, here, I fire the events when i press buy. And the events should do as intended

-- Player vars
local Player = game.Players.LocalPlayer
local leaderboard = Player:WaitForChild("leaderstats")

-- Currencies
local Coins = Player.leaderstats.Coins

-- services
local RS = game:GetService("ReplicatedStorage")
local SS = game:GetService("ServerStorage")
local SG = game:GetService("StarterGui")

-- Events 
local EFolder = game.ReplicatedStorage:WaitForChild("EventsFolder")-- Brings the folder
local CPurchase = EFolder:WaitForChild("CoinsPurchase")
local OweItem = EFolder:WaitForChild("OwnedItem")
local Affordable = EFolder:WaitForChild("OwnedItem")


-- Buttons and item data
local button = script.Parent
local price = script.Parent.Parent.Price
local thisName = script.Parent.Parent.ItemNameview
local SelectedName = script.Parent.Parent.ItemName

-- More Buttons
local ItemPurchase = script.Parent
local targetPrice = script.Parent.Parent.Parent.WeaponsScrollingFrame.Item.ItemCoinsPrize

-- CheckItemsOwned folder 
local ItemsOwnedFolder = RS.WhereItemsROwned

-- Purchased 
local PFrame = script.Parent.Parent.PurchasedLabel
-- Mischellanious shop 
local WaponsFrame = SG.Navigations.EquipmentFrame.WeaponsScroller


-- Purchase
button.MouseButton1Click:Connect(function()
	CPurchase.FireServer() -- Coins purchase 
	OweItem.Fireserver() -- See if item is owned
	Affordable.FireServer() -- See if items affordable
	
		
	if leaderboard.Coins.Value >= price.Value then
		leaderboard.Coins.Value = leaderboard.Coins.Value - price.Value
		local RSItem = RS:WaitForChild(thisName.Text)
		if RSItem then 
			if PFrame.Visible == false then
				PFrame.Visible = true

			else 
				PFrame.Visible = false
			end
			
		end
		RSItem:Clone().Parent = ItemsOwnedFolder
		local RSAsset = RS.Assets:WaitForChild(thisName.Text)
		RSAsset:Clone().Parent = WaponsFrame
		RSAsset:Clone().Position = UDim2.new({0.028, 0},{0.011, 0})
		
	end
	
	if leaderboard.Coins.Value < price.Value then
		script.Parent.Parent.Parent.InsufficientDisplay.Visible = true
	end
	
	
	
	
end)

And I'm also struggling to figure out how to move an imagebutton(Item button With all its Properties) into an Equipment GUI frame where items that youve bought are shown. How do I move it there and be able to show it in the Equipment?

3 comments

1

The client cannot access the descendants of ServerStorage.

0

^ only the server can

0

@sjr04Alt is it exactly how it should be, the way you said it?