Ok, so here a problem Here script. This script for shop system. When player clicking button with scirpt = adding item from library of itemids (ServerStorage) with amount item that player wanted. Technically this script adding intvalue with name that is itemid, value is amount items, into folder that setuped by special script. Anyone can help with this? Here scripts, if you need. This its button that adding item
local object = game.ServerStorage local localplayer = game.Players.LocalPlayer local folder = localplayer.Items script.Parent.Parent.TextButton.MouseButton1Down:connect(function() for i, items in pairs(object:GetChildren()) do local addeditem = Instance.new("IntValue") addeditem.Name = items[1].Value addeditem.Value = addeditem.Value + 1 addeditem.parent = folder end end)
And this script is setup for items
local Players = game:GetService("Players") local player = game.Players.LocalPlayer game.Players.PlayerAdded:connect(function(player) local itemsfolder = Instance.new("Folder") itemsfolder.Name = "Items" itemsfolder.Parent = game.Players.LocalPlayer warn("Player with name like ".. player.Name.. " is ready!") end)
Local Scripts Can't access Server Storage
Use ReplicatedStorage
.
--Local Script local object = game.ReplicatedStorage local localplayer = game.Players.LocalPlayer local folder = localplayer.Items script.Parent.Parent.TextButton.MouseButton1Down:connect(function() for i, items in pairs(object:GetChildren()) do local addeditem = Instance.new("IntValue") addeditem.Name = items.Value-- tiems isn't a table addeditem.Value = addeditem.Value + 1 addeditem.parent = folder end end)
Scripts can't access Local Player.
Don't do that,
--Regular Script local Players = game:GetService("Players") Players.PlayerAdded:connect(function(player) local itemsfolder = Instance.new("Folder") itemsfolder.Name = "Items" itemsfolder.Parent = player warn("Player with name like ".. player.Name.. " is ready!") end)
Good Luck!