So i want to create a tool giver (a ticket machine to be exact). And i want it to have a expiration time. But if the first ticket given expires, it gives the expired ticket. I ran out of ideas how to fix that
My code: Ticket machine:
local cd60 = script.Parent.szescdziesiatmin.ClickDetector
local min60 = script.min60:Clone()
cd60.MouseClick:Connect(function(plr)
min60.Parent = plr.Backpack
end)
Ticket validator:
script.Parent.Touched:Connect(function(hit)
if hit.Parent.Name == "min5" or "min10" or "min60" then
hit.Parent.Value.Value = "valid"
hit.Parent.Script.Disabled = false
-- the script that defines validity is disabled before validating
end
end)
Script inside tickets that defines validity:
wait(3600)
script.Parent.Name = "Not valid"
script.Parent.Handle.SurfaceGui.TextLabel.Text = "60 minute ticket (not valid)"
