Hello DevForum Community
So I must describe what 'm trying to do, I am trying to add items or tool to this Bank System Shop, but don’t know how.
If someone knows, can you tell me how to add items or tools? And which one I can add?
Thanks.
1 Like
im 6 hours late but why not
- Add a UIGridLayout to a invisible frame with all the items.
- Add frames with a ImageButton and TextLabel inside the invisible frame. Using a script and remote.
-- LocalScript
local ReplicatedStorage = game:GetService('ReplicatedStorage')
local remote = ReplicatedStorage:WaitForChild('BankShop')
local frame = script.Parent
local template = path.to.template
local tools = {
[3] = 'Bloxy Cola',
[6] = 'Something'
}
for image, tool in pairs(tools) do
local clone = template:Clone()
local button = clone:WaitForChild('Image')
local text = clone:WaitForChild('ItemName')
text.Text = tool
button.Image = 'rbxassetid://' .. image
button.MouseButton1Click:Connect(function()
remote:FireServer(tool)
end)
end
-- Serverscript
local ReplicatedStorage = game:GetService('ReplicatedStorage')
local ServerStorage = game:GetService('ServerStorage')
local remote = ReplicatedStorage:WaitForChild('BankShop')
local prices = {
['Bloxy Cola'] = 50,
['Something'] = 5
}
remote.OnServerEvent:Connect(function(player, name)
local price = prices[name]
local item = ServerStorage:FindFirstChild(name)
if not price or not item then
return warn('Invalid item.')
end
if player.leaderstats.Cash.Value >= price then
-- give the item here
end
end)
- Now your done, I wrote this inside devforum so it may not work.
1 Like
When I find out how to do that correctly, I’ll try, thank you, and don’t worry about the delay