Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

This script should be working as soon as my character spawns, however it isn't. Why?

Hello, I have tried adapting this script to work as soon as I spawn, giving it time to wait for my Character to load. However, this script only works once I return the item from my character. (Equipping then unequipping). May I have an answer to this please?

local Players = game:GetService("Players")

game.Players.PlayerAdded:Connect(function(player)
	player.CharacterAdded:Connect(function(character)
		repeat wait(1) until character.Backpack
		for _,player in pairs(Players:GetChildren()) do
			player.Backpack.ChildAdded:Connect(function(child)
				print("test")
				if player.Backpack:WaitForChild(child):IsA("Tool") then
					print("yes")
				end
			end)
		end
	end)
end)

1 answer

I don't know if this answers your question, but on line 5, you are calling for character.Backpack. On every other line, you are calling for player.Backpack, which is the correct location for a player's backpack.

2 comments

0

Nope, I think I have an error with the wait for child too, though! Thanks for helping.

0

No problem, glad I could help (if I did).

This discussion is preserved as it was. New answers, comments, and votes are closed.