You can write your topic however you want, but you need to answer these questions:
-
What do you want to achieve? Well… I would like to fix this error.
-
What is the issue? “Attempt to index nil with ‘day’”, but the problem is that Day is a valid child.
local players = game:GetService("Players")
local player = players.LocalPlayer
local replicatedstorage = game:GetService("ReplicatedStorage")
local events = replicatedstorage:WaitForChild("Events")
local BG = script.Parent.BG
local List = BG:WaitForChild("List")
local ClockedIn = List:WaitForChild("ClockedIn")
local Schedule = List:WaitForChild("Schedule")
local Date = BG:WaitForChild("Date")
local AssociateName = BG:WaitForChild("AssociateName")
local function SetupPhone()
if events.GetUser:InvokeServer("isStaff") == true then
local Schedule = events.GetUser:InvokeServer(player.UserId, "Schedule")
local dateFormat = "Today is %A, %B %d"
local date = os.date(dateFormat)
local weekday = os.date("%A")
--//SetupApp
AssociateName.Text = "Hey there, "..tostring(player.DisplayName)
Date.Text = tostring(date)
Schedule.Day.Text = tostring(weekday)
Schedule.Hours.Text = Schedule[weekday]
Schedule.Rank.Text = tostring(player:GetRoleInGroup(16007840))
end
end
task.wait()
SetupPhone()
Line 27 is the error.