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)

1 comment
for other players, their tool is also unfrozen