Hey, i'm trying to check if a player has Ready.Value == true but i got a error Attemp to index field "LocalPlayer" a nil value
Here is the code:
for i,v in ipairs(game.Players:GetPlayers()) do
if v then
if v.Character and game.Players.LocalPlayer.Ready.Value== true then --/Error
local t=v.Character:FindFirstChild("HumanoidRootPart")
local h=v.Character:FindFirstChild("Humanoid")
if t~=nil and h~=nil then
if h.Health>0 then
t.Velocity = Vector3.new(0,0,0)
v.Character:MoveTo((CFrame.new(-109,47,16.5)+Vector3.new((math.random()-.5)*40,0,(math.random()-.5)*40)).p)
local st = Instance.new("StringValue")
st.Name = "SurvivalTag"
st.Value = lastDisaster.Name
local st2 = Instance.new("StringValue")
st2.Name = "MapName"
st2.Value = ns.Name
st2.Parent = st
local st3 = Instance.new("IntValue")
st3.Name = "ExposureTag"
st3.Value = 0
st3.Parent = st
st.Parent = v.Character
if v.DataReady then
disasterscore = v:LoadNumber("Played"..lastDisaster.Name) or 0
v:SaveNumber("Played"..lastDisaster.Name,disasterscore+1)
mapscore=v:LoadNumber("Played"..ns.Name) or 0
v:SaveNumber("Played"..ns.Name,mapscore+1)
totalscore=v:LoadNumber("PlayedTotal") or 0
v:SaveNumber("PlayedTotal",totalscore+1)
end
end
end
end
end
end

2 comments
I tried to use Player but keep getting the same error
Data persistence is deprecated. Use DataStoreService.