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

How to fix problem with ChildAdded in LocalScript?

Hello, everyone. I wanted to make Hand To monitor. And I have problem. ChildAdded is not work I don't know why. I'm not getting Error.

Code: (LocalScript)

local Player = game:GetService("Players").LocalPlayer

game:GetService("Players").ChildAdded:connect(function(child)
	local Button = Instance.new("TextButton",script.Parent.Main)
	Button.Text = child.Name
	Button.Name = child.Name
	Button.TextScaled = true
	
	Button.MouseButton1Click:connect(function()
		if Player.Character:FindFirstChildOfClass("Tool") then
			local Tool = Player.Character:FindFirstChildOfClass("Tool")
			local GetClone = Tool:Clone()
			GetClone.Parent = game:GetService("Players"):FindFirstChild(Button.Text).Backpack
		end
	end)
end)

1 comment

0

You should use PlayerAdded, not ChildAdded. Also, you shouldn’t be using PlayerAdded from a localscript.

1 answer

Your script is not working because a localscript can't do anything to other clients. Localscripts only work for their client. To fix this problem, I would use a server script instead.

Don't know what else to add, really. Ask if you have questions.

1 comment

0

u are beautiful

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