I’ve been getting an error on a group scanner that I’ve been making. Currently, it is checking if a user is in any of the groups listed. If not, it takes action. But, in testing, whenever I changed the group my testing user is in that does not meet the requirement, I get a strange error that I cannot explain. Attached is my script and the error.
local TI = TweenInfo.new(3,Enum.EasingStyle.Sine,Enum.EasingDirection.InOut)
local Tween1 = TS:Create(script.Parent.Scanner,TI,{["CFrame"] = CFrame.new(21.88, 0.938, 187.313)})
local Tween2 = TS:Create(script.Parent.Scanner,TI,{["CFrame"] = CFrame.new(21.88, 7.438, 187.313)})
local isActive = false
local touchedPlayers = {}
script.Parent.StartScan.Event:Connect(function()
if isActive == false then
isActive = true
table.clear(touchedPlayers)
script.Parent.Scanner.Transparency = 0
Tween1:Play()
wait(3)
Tween2:Play()
wait(3)
Tween1:Play()
wait(3)
Tween2:Play()
wait(3)
script.Parent.Scanner.Transparency = 1
for i, plr in pairs(touchedPlayers) do
if not plr:IsInGroup(1022142) and not plr:IsInGroup(938043) and not plr:GetRankInGroup(157764) >= 110 then
plr.Character.Humanoid:BreakJoints()
end
end
table.clear(touchedPlayers)
isActive = false
end
end)
script.Parent.Scanner.Touched:Connect(function(hit)
local h = hit.Parent:FindFirstChild("Humanoid")
if h then
local plr = game.Players:GetPlayerFromCharacter(h.Parent)
if plr then
table.insert(touchedPlayers,plr)
end
end
end)