Hey, I wanna check if my tool's parent is a player. I used a table to get all the descendants of workspace and anchored them. But, when I hold out my tool, it is also anchored. I want something that can check if the tool's parent is a player and then skip the item.
local Event = game.ReplicatedStorage.Event.TimeStopEvent local InUse = game.ReplicatedStorage.Event.InUse local Sound = game.Workspace.TheWorldSound local Resume = game.Workspace.ResumeTime local Table = {} game.ReplicatedStorage.Event.TimeStopEvent.OnServerEvent:Connect(function(player) local descendants = Workspace:GetDescendants() -- gets all things under workspace if game.ReplicatedStorage.Event.InUse.Value == false then game.ReplicatedStorage.Event.InUse.Value = true Sound:Play() game.Lighting.Gay.Saturation = -1 game.Lighting.Gay.Enabled = true for i = 255, 0, -31.875 do game.Lighting.Gay.TintColor = Color3.fromRGB(i, 0, 255) wait() end for i = 0, 255, 31.875 do game.Lighting.Gay.TintColor = Color3.fromRGB(0, i, 255) wait() end for i = 255, 0, -31.875 do game.Lighting.Gay.TintColor = Color3.fromRGB(0, 255, i) wait() end for i = 0, 255, 31.875 do game.Lighting.Gay.TintColor = Color3.fromRGB(i, 255, 0) wait() end for i = 0, 255, 31.875 do game.Lighting.Gay.TintColor = Color3.fromRGB(255, 255, i) wait() end for i = 1, #descendants do -- Getting all the things under workspace and putting them in TABLE if descendants[i]:IsA("Part") or descendants[i]:IsA("MeshPart") then --checking each individual descendant if descendants[i].Anchored == false and descendants[i].Parent.Name ~= player.Name and descendants[i].Name ~= ("Handle") and descendants[i].Name ~= ("Baseplate") and not descendants[i].Parent:IsA ("Accessory") then descendants[i].Anchored = true -- if all requirements met, they are anchored table.insert(Table, descendants[i]) -- creates table of anchored descendants end end end elseif game.ReplicatedStorage.Event.InUse.Value == true then InUse.Value = false Resume:Play() for i = -1, 0, 0.125 do game.Lighting.Gay.Saturation = i -- ts effect wait() end for i = 1, #Table do -- take the table we made of the descendants from earlier and then unanchor them local descendants = Table[i] descendants.Anchored = false end table.clear (Table) end end)
You can just simply skip any instance that is a tool/is a child of a tool inside of your anchoring script. Something like
If not object:IsA(“tool”) or object.Parent == “tool” then — anchor script here end
I dont have the script so I dont know exactly what your doing
local timeStopUser = player.Name -- You can also fire some events to set the variable's name to the player who used Time Stop if (descendants[i].Parent.Name == timeStopUser) then -- Do something end