-
What do you want to achieve?
I am working on some local script. That local script is being cloned into the player’s character upon joining/respawning. Then the variable referenced to the cloned script is put into a table. Every X seconds, the server checks if the script is still there with the earlier inserted table value. -
What is the issue? Include screenshots / videos if possible!
Well, the table value isn’t nil and stuff it works as it should, but every time I try to see if it is there, the script says it isn’t. I’m not sure if I correctly set the if statement up but I am lost now… -
What solutions have you tried so far? Did you look for solutions on the Developer Hub?
I tried looking on the dev forum and trying to figure things out myself but nothing helped.
After that, you should include more details if you have any. Try to make your topic as descriptive as possible, so that it’s easier for people to help you!
The script:
local ReportRemote = script.ReportDetection
local LocalDetection = script.LocalDetection
ReportRemote.Parent = game:GetService("ReplicatedStorage")
local References = {}
game.Players.PlayerAdded:Connect(function(player)
player.CharacterAdded:Connect(function(character)
local ClonedScript = LocalDetection:Clone()
ClonedScript.Parent = character
ClonedScript.Name = HttpService:GenerateGUID(false)
References[player.UserId] = ClonedScript
end)
end)
game.Players.PlayerRemoving:Connect(function(player)
References[player.UserId] = nil
end)
while task.wait(10) do
for _,player in pairs(game:GetService("Players"):GetPlayers()) do
if player.Character then
if not player.Character.References[player.UserId] then
print("Not found")
else
print("found")
end
end
end
end