Greetings! Im have a trouble. Im scripted a chest for place and pick up items in gui.
So, Now, loot in chest can see only 1 player (the long story short: Player A place items for example logs. But Player B cant see whats Player A placed. If Player B place something again, Player A cant see whats Player B placed)
So scripts:
Proximity Prompt
local opened = false
local code = script.Parent.Parent.VirtualCode.Value
local open = script.Parent.Parent.Parent.AnimationController:LoadAnimation(script.Parent.Parent.Parent.Opened)
script.Parent.Triggered:Connect(function(plr)
opened = true
local nim = script.Parent.Parent.Parent.AnimationController:LoadAnimation(script.Parent.Parent.Parent.Open)
nim:Play()
open:Play()
local existingGui = plr.PlayerGui:FindFirstChild("ChestGUI_" .. code)
local existingFolder = game.Workspace:FindFirstChild("Tools_".. code)
if existingGui then
existingGui.Enabled = true
else
local chestGui = script.Chest:Clone()
chestGui.Name = "ChestGUI_" .. code
chestGui.Parent = plr.PlayerGui
chestGui.Enabled = true
chestGui.Frame.Code.Value = code
end
if existingFolder then
else
local chestGui = Instance.new("Folder")
chestGui.Name = "Tools_" .. code
chestGui.Parent = game.Workspace
end
end)
then scripts in gui
Main script
local MAX = 1
script.Parent.PlaceTool.OnServerEvent:Connect(function(plr)
for i,item in plr.Character:GetDescendants() do
if item:IsA("Tool") then
local button = script.Parent.ScrollingFrame.Example:Clone()
button.Name = "AH"
button.Text = item.Name
button.Parent = script.Parent.ScrollingFrame
button.Visible = true
item.Parent = game.Workspace:FindFirstChild("Tools_".. script.Parent.Code.Value)
end
end
end)
script.Parent.PickUpTool.OnServerEvent:Connect(function(plr,a,nam)
MAX = 0
for i,item in game.Workspace:FindFirstChild("Tools_".. script.Parent.Code.Value):GetDescendants() do
if item:IsA("Tool") then
if item.Name == nam and MAX == 0 then
item.Parent = plr.Backpack
MAX = 1
end
end
end
end)
So, i have buttons to place and pick up. All working but localy. Im need to globalize it. If you can help, please, tell me how.