woitur
(Koala)
October 12, 2022, 9:08pm
#1
local GemsButtons_Folder = game:GetService("ServerStorage"):FindFirstChild("GemsButtons_Folder")
Loot_to_Inventory_Event.OnServerEvent:Connect(function(plr, textbutton)
print(textbutton)
local TextButton = GemsButtons_Folder:FindFirstChild(textbutton)
print(TextButton)
--if TextButton then
TextButton:Clone().Parent = plr:FindFirstChild("Inventory")
--end
end)
Explorer
What it prints
Thank you
1 Like
woitur
(Koala)
October 12, 2022, 9:09pm
#2
Thats the error
attempt to index nil with 'Clone'
1 Like
Graalian4
(Graalian)
October 12, 2022, 10:22pm
#3
local GemsButtons_Folder = game:GetService("ServerStorage"):FindFirstChild("GemsButtons_Folder")
Loot_to_Inventory_Event.OnServerEvent:Connect(function(plr, textbutton)
print(textbutton)
local GetChildren = GemsButtons_Folder:GetChildren()
for i = 1, #GetChildren do
if GetChildren[i]:IsA("TextButton") then
print(GetChildren[i])
--if TextButton then
GetChildren[i]:Clone().Parent = plr:FindFirstChild("Inventory")
--end
end
end
end)
its because you aren’t specifying what the script should print. For example:
print(TextButton.Name)
But you aren’t telling what the script should print
3 Likes
woitur
(Koala)
October 12, 2022, 11:16pm
#5
I dont understand what you mean. I try to print just the Instance (it will print the adress of the object inside the memory)
1 Like
woitur
(Koala)
October 12, 2022, 11:17pm
#6
I dont understand why you gave me this script. This script will just shove all the children of the gembuttons folder (all the textbuttons) inside the players inventory. I need only the textbutton with the name that got sent by the client.
1 Like
CodedJack
(jack)
October 12, 2022, 11:19pm
#7
Can I see the client script which uses FireServer.
1 Like
woitur
(Koala)
October 12, 2022, 11:23pm
#8
--Moves the Gem to Inventory
textbutton.MouseButton1Down:Connect(function()
Loot_to_Inventory_Event:FireServer(textbutton.Name)
textbutton.Parent = PlayerGui:WaitForChild("InventoryScreenGui"):WaitForChild("InventoryFrame").ScrollingFrame
end)
1 Like
dutycall11
(SavageMode)
October 12, 2022, 11:43pm
#9
try print GemsButtons_Folder
if it doesn’t print nil replace line 68 with:
local TextButton = GemsButtons_Folder:WaitForChild(textbutton)
1 Like
dutycall11
(SavageMode)
October 12, 2022, 11:44pm
#10
oh I figured out the issue you are moving the textbutton when the remote event is fired.
Do this line in the remote event:
textbutton.Parent = PlayerGui:WaitForChild("InventoryScreenGui"):WaitForChild("InventoryFrame").ScrollingFrame
1 Like
woitur
(Koala)
October 12, 2022, 11:48pm
#11
Isnt what you sent me the same thing I have?
Like the same line of code
1 Like
dutycall11
(SavageMode)
October 12, 2022, 11:49pm
#12
No I added waitforchild()
char limit
1 Like
woitur
(Koala)
October 12, 2022, 11:51pm
#13
textbutton.Parent = PlayerGui:WaitForChild("InventoryScreenGui"):WaitForChild("InventoryFrame").ScrollingFrame
I added this piece of code, still doesnt work
1 Like
woitur
(Koala)
October 12, 2022, 11:53pm
#15
If I put the line of code in the server, it infinite yields
local TextButton = GemsButtons_Folder:WaitForChild(textbutton)
1 Like
dutycall11
(SavageMode)
October 12, 2022, 11:54pm
#16
In the remote event you are doing this:
textbutton.Parent = PlayerGui:WaitForChild("InventoryScreenGui"):WaitForChild("InventoryFrame").ScrollingFrame
Remove this line and put it in the remote event at the end
1 Like
dutycall11
(SavageMode)
October 12, 2022, 11:54pm
#17
that means GemsButtons_Folder is nil
1 Like
woitur
(Koala)
October 12, 2022, 11:55pm
#18
--Moves the Gem to Inventory
textbutton.MouseButton1Down:Connect(function()
Loot_to_Inventory_Event:FireServer(textbutton.Name)
textbutton.Parent = PlayerGui:WaitForChild("InventoryScreenGui"):WaitForChild("InventoryFrame").ScrollingFrame
end)
after what end? this is the whole block of code
1 Like
woitur
(Koala)
October 12, 2022, 11:55pm
#19
yea the GemsButtons_Folder isnt found for some reason
1 Like
dutycall11
(SavageMode)
October 12, 2022, 11:56pm
#20
Can you show the entire remote event script?
1 Like
woitur
(Koala)
October 12, 2022, 11:56pm
#21
Explorer
Variable
local GemsButtons_Folder = game:GetService("ServerStorage"):FindFirstChild("GemsButtons_Folder")
1 Like