Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

RPG Daily/Win Roll I need help don't know how to add time system?

Asked by 7 years ago

2 things that I can't seem to get done for this. First let me explain what it is, it's a daily roll to win prize for my new RPG. It allows you to click a button to randomly pick of 3 options. And it changes text to what you won, etc. Everything works except the Image does not load. I originally had the Image ID for if you won gold/xp to the value of Gold/XP then I just but in the assets to see if that work, and still no image shows up showing you the image of a gold/xp image of what you won. Don't know why, no errors in output everything is visible, not transparent. And secondly, how do I make this so it you can only roll it once every 24 actual real life hours or maybe every 2-3 hours of playtime without using a leaderboard that counts every second they've been in the game (I'd rather have the 24 hour thing but I'm willing to compromise). Thanks for you're help, I really do respect the time you put into helping others. And I am looking for someone to help me make this game if you're not busy c; we only have 3 on the project rn it's going really slow.

local RollToWin = script.Parent.DailyWin:GetChildren() local Gold = game.Workspace.DailyWinGold.Value local XP = game.Workspace.DailyWinXP.Value local DailyReward = script.Parent local StartWin = script.Parent.VisibleFrame.ClickToSpin

local WinText = script.Parent.VisibleFrame.YouWin

StartWin.MouseButton1Down:connect(function()

local ranItem = math.random(1,#RollToWin) local ItemChosen = RollToWin [ranItem] print(ItemChosen)

WinText.Text = "Item Won:"..ItemChosen.Name

if ItemChosen == "150 Gold" then DailyReward.VisibleFrame.PrizePicture.Image = "rbxassetid://482469499"

elseif ItemChosen == "50 Gold" then DailyReward.VisibleFrame.PrizePicture.Image = "rbxassetid://482469499"

elseif ItemChosen == "75" then DailyReward.VisibleFrame.PrizePicture.Image = "rbxassetid://384520177"

end

end)

1 answer

Log in to vote
0
Answered by 7 years ago

Using DataStores, you can save the time it is for the player using os.time, and every time they join, you can check if the saved time has been increased by a day by using the forulma 606024. As for the assets not loading, you could use the ContentProvider service.

0
Wouldn't this be easy to bypass since a user can easily change the time on their computer? InfinitivePixelsJr 542 — 7y
0
os.time gets the time since the epoch, so I don't think so. I'm pretty sure tick() is the one you can change. toxicOverseer 10 — 7y
Ad

Answer this question