Oh ok, that might be the problem, thanks. I’ll first focus my attention on getting the tool though. I’ll try to fix some of the problems .
If you want to get all the tools in your backpack you should use the example provided. Keep in mind this will only work for tools in the backpack when it runs the check. You can add a wait.
Example
for i,v in pairs(PlayerObject.Backpack:GetChildren()) do
if v:IsA("Tool") then
v.Activated:Connect(function()
--//Code here
end)
end
end
Thanks, I’ll try that out. I just fixed the first two problems you mentioned above. I parented the StringValue activeTool to player, and also used a for loop to print the names of the children of the backpack, and printed the length of it, but it doesn’t print anything out, and it says the table length is 0.
Also, I forgot to mention. The activeTool value is created on a localscript. So it doesn’t exist on the server. You should probably use the PlayedAdded event to create the value when the person joins on the server.
Yeah I’m going to create a separate script for that later on. I’ve tried implementing the script you provided and it didn’t do anything.
local player = game.Players.LocalPlayer
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local PickInfo = require(ReplicatedStorage.PickInfo)
local activeTool = Instance.new("StringValue")
activeTool.Parent = player
activeTool.Name = "ActiveTool"
activeTool.Value = "None"
local Backpack = player:WaitForChild("Backpack")
print(Backpack, Backpack.Parent)
wait(5)
for i,v in pairs(player.Backpack:GetChildren()) do
if v:IsA("Tool") then
v.Activated:Connect(function()
print("nice")
end)
end
end
not to mention the print(Backpack, Backpack.Parent), prints “Backpack, nil” which doesn’t make sense because if it has gotten Backpack, then theoretically the player/parent of the backpack has to exist right?
Your printing this before the wait. The player may have not loaded nor the backpack.
the print is after the WaitForChild(“Backpack”)
Can you screenshot your console after testing the game and equipping a tool and activating it, keep in mind you must wait 5 seconds before equipping and testing a tool. Since your doing :WaitForChild(“Backpack”) the 5 seconds seems a bit long, maybe adjust it to 1.
Ok im trying to send it, but I have to switch to a different device to send it for some reason, and the Roblox login is getting a bit annoying.
By any chance do you know why devforum is saying access denied when I click login on a separate device
Are you on a windows or mac device?
Edits:
Mac Screenshot - Command + Shift + 4 (Then select the area you want to screenshot)
Windows - WindowsButton + PrntScr (Full screen shot only)
I believe there is a built in screenshot option on Roblox studio under the view tab
Oh for **** sake. Im on Mac, but I just realized that the devforum isn’t for ages <13 right? and my account got hacked a week+ ago and they changed my birthday to 2015, and roblox never changed it back. So now I can’t use devforum on a seperate device again.
No, my browsers on Mac don’t give me any popup when I try to click the choose file options
Hold Command and Shift and 3 for a fullscreen screenshot, it will save to your desktop.
Yeah I know, but normally when there’s a choose file button like on this dev forum, you get a popup to choose a file/img from your computer drive, but it never pops up on my Mac browsers
Ok I hope it works now: Imgur: The magic of the Internet
Edit: also I made a slight change in the print by removing the extra 1 at the end before testing it out
Did you equip the tool and click it a few times to activate it?
Oh wait It works sometimes, but other times when I click play and equip and click the tool nothing prints.
Thanks btw, I marked your above comment as the solution since it seems to work now.