Hello all, I am in need of support. I have been trying for days to find a solution for this error. Basically, the player variable returns nil, and I am literally unable to find why it's nil. I've scoured the internet for answers but most of them are just specific to the people who made the question... anyways, can someone help me fix this dreadful error?
As always with Data Stores, this is a server script.
local dss = game:GetService("DataStoreService")
local WindowsActivated = dss:GetDataStore("WindowsActivated")
local frame = script.Parent
--local t = frame.activateText
local value = script.Parent.Parent.activation.activated
game.Players.PlayerAdded:Connect(function(plrobj)
plr = game.Players:FindFirstChild(plrobj)
end)
while true do
wait(0.2)
local success, errormsg = pcall(function()
WindowsActivated = WindowsActivated:GetAsync(plr.UserId.."activated")
end)
if not success then
warn(errormsg)
end
if WindowsActivated == "true" then
--t.Visible = false
frame.mainScrollFrame.Visible = true
else
--t.Visible = true
frame.mainScrollFrame.Visible = false
end
end
Thanks in advance.

1 comment
use plrobj instead of plr, remove plr entirely, or if you do want to use plr then add plrobj.Name in the parenthesis of line 9