For example game logic that counts how much subscriber’s + views you will get from one video. How would I go about making that?
Sorry, could you explain what you’re end goal is in a lot more depth? Do you have any of the game built so far?
No, not yet. I want a logic script that somehow finds out how much views and subscribers the user who uploads the video gets.
I’m sorry, but you’ll have to be a lot more specific. What does this look like? Do you literally mean YouTube as in the real website, or are you making some kind of pretend YouTube within roblox?
What do you mean by “upload”? Is that something people would do in your game? Or are you trying to access data from YouTube.com?
What does “will get” mean? Are you trying to predict these numbers? Based on what?
You’d go about this by using math.random() (the args would probably be dependent on how many subscribers the player already has):
https://developer.roblox.com/en-us/api-reference/lua-docs/math
Good luck!
Have you heard of youtuber simulator? I am trying to make a game like that
Ok So make a Table that has 3 Values Subscribers,View,Videos and now Everytime the player Publishes the video it adds +1 to the current Videos Value and yuh also make a leaderstats,and math.random() for view but if you want to be more specific if a player publishes his first video obviously it won’t do well so you can make a rang of 1-1000 views and it generates a random number between those values and Subscribers is more tricky…
Sure but here is the code I made before you replied :
local ReplicatedStorage = game:GetService("ReplicatedStorage")
ReplicatedStorage.UploadVideo.OnServerEvent:Connect(function(plr)
local subs = plr:WaitForChild("leaderstats").Subscribers.Value / 10
local random = math.random(1*subs,10*subs)
if random == 0 then random = math.random(1,10) end
plr.leaderstats.Subscribers.Value += random
end)
what does the output say? is there any errors?
Oh, there are no errors, but when I get 2 billion subscribers It no longer lets me get more, do you know why maybe?
This is because you’ve reached the lua integer limit (It’s about 2 billion) some solutions to this are:
Use scientific notation e.g saying 2x109 and making that read as 2B
You can just lower the amount of views per video since 2 billion is a bit unrealistic
Is there a way to increase the limit?
Yes, its because of max integer limit. You should change your IntValue for the subscribers to a NumberValue so it can store around 9 Quadrillion as a value or find a another way.
Okay, will do that but, how would I go about making the logic system more realistic?
Just change the random number to a drastically lower number because usually you don’t have 10x your subscribers watching your videos:
local random = Random.new():NextNumber(0.5 * subs, 3 * subs)
I can just use math.random() right?
Nope, still stopping at 2.5 billion by the way
You should use Random.new(), but if math.random() supports decimals then go ahead.
What is your code? It works for me.
Never mind I forgot to put this in, thank you!