Making a script that changes the color of something everytime a tool is equipped, the problem is though I cannot get the player. the script doesn’t refer to any specific tool, instead checking if ANY tool is equipped.
local Tool = script.Parent
plr.Character.ChildAdded:Connect(function(tool)
if tool:IsA("Tool") then
for _, thing in ipairs(script.Parent:GetDescendants()) do
if thing:IsA("SelectionBox") then
thing.Color3 = plr.TeamColor.Color
end
end
end
end)
end)
local player = Backpack.Parent
The parent will be the player because backpack is a child of player, and you can use player.Character to get the character.
local Tool = script.Parent
plr.Character.ChildAdded:Connect(function(tool)
if tool:FindFirstChildWhichIsA("Tool") then
for _, thing in ipairs(script.Parent:GetDescendants()) do
if thing:IsA("SelectionBox") then
thing.Color3 = plr.TeamColor.Color
end
end
end
end)
end)