Hi, I’m trying to make a system, where when a player stays at a cash register for a specific amount of time, and then unclaims the register automatically.
I’m getting the error, that player is “nill”.
I’ve looked up so many solutions none of them seemed to work.
Main Code:
local Claimed = script.Parent.Claimed
local LoggedPlayer = script.Parent.LoggedPlayer
local PassingTime = script.Parent.PassingTime
local Events = game.ReplicatedStorage.Registers
Events.Register1.Event:Connect(function(player)
if Claimed.Value == true and player.Name == LoggedPlayer.Value and player.PlayerHasClaimedRegister.Value == true and PassingTime.Value == script.Parent.MaxTime.Value then
Claimed.Value = false
script.Parent.MaxTime.Value = 1200
PassingTime.Value = 0
script.Parent.Display.TimePassed.Text = 0
player.PlayerHasClaimedRegister.Value = false
script.Parent.Display.UIGradient.Color = ColorSequence.new(Color3.new(0.686275, 1, 0.713725), Color3.new(1, 1, 1))
LoggedPlayer.Value = ""
script.Parent.Display.TextLabel.Text = "Unclaimed Register (Click to Claim)"
end
end)
Any help would be gladly appreciated.