Hi guys! I’m trying to make a daily shop rotation and assign player values to skins I made a module script that i placed in StarterPlayerScripts.
local skins = {
Slot1 = nil;
Slot2 = nil;
Slot3 = nil;
Slot4 = nil;
}
return skins
So this is the module script i created they are all nil because there is no data assigned to them. Can someone explain to me on how to make a daily shop refresh i made this script and there are no errors.
local skins = game.ReplicatedStorage.Skins
local heirachry = {
Item1 = script.Parent.MAIN_ITEM;
Item2 = script.Parent.RANK_2;
Item3 = script.Parent.RANK_3;
Item4 = script.Parent.RANK_3;
}
--// Displayer
print("YEET")
while true do
local date = os.date("!*t")
if date["hour"] == 0 and date["min"] == 00 and date["sec"] == 00 then
for i,v in pairs(heirachry) do
if v.ViewPort:GetDescendants() == 0 then
local viewportinstance = v.ViewPort
local viewportcam = Instance.new("Camera")
viewportcam.Parent = viewportinstance
local randomskinselection = skins:GetChildren()
local chosenskin = math.random(1,#randomskinselection)
viewportcam.CurrentCamera = viewportcam
viewportcam.FieldOfView = 10
chosenskin.Parent = viewportinstance
viewportcam.CameraSubject = chosenskin
else
local leftbehinds = v.ViewPort:GetDescendants()
for a,b in pairs(leftbehinds) do
leftbehinds:Destroy()
--//After removing all the left behind descendants it does the stuff it needs to do
local viewportinstance = v.ViewPort
local viewportcam = Instance.new("Camera")
viewportcam.Parent = viewportinstance
local randomskinselection = skins:GetChildren()
local chosenskin = math.random(1,#randomskinselection)
viewportcam.CurrentCamera = viewportcam
viewportcam.FieldOfView = 10
chosenskin.Parent = viewportinstance
viewportcam.CameraSubject = chosenskin
end
end
end
else
print("NOT THE DAY YOU WANT")
end
wait(100)
end
So im trying to create a daily refresh that changes up the skins displayed and sets up the viewport frame. I tested this and it does not work. At all. Can someone help me or tell me how to improve it. Many thanks!!