Hey there!
I’m working on improving my code, however i got myself stuck.
I am trying to make some variables (numbers) to strings so I can access them in a loop. However, when I try to play the game, it shows the values to be ‘nil’
local subs = (player["stats"].Subs.Value + 250) * player.stats.Multiplier.Value * player.stats.SubsMultiplier.Value
local videoViews = math.round((math.random(10,30)/10) * subs)
local videoLikes = math.round((math.random(2,7)/10) * videoViews)
local videoSubs = math.round((math.random(5, 15)/100) * videoViews)
remotes.PostVideo:FireServer(videoViews, videoLikes, videoSubs)
local dataTable = {
'vidViews' == videoViews,
'vidLikes' == videoLikes,
'vidSubs' == videoSubs
}
for i, stat in pairs({'Views','Likes','Subs'}) do
local popup = replicatedStorage[stat..'Popup']:Clone()
popup.Parent = popupFrame
coroutine.wrap(function()
popup.Parent = popupFrame popup.Position = UDim2.new((math.random(0,100)/100),0,(math.random(0,100)/100), 0)
task.wait(4)
popup:Destroy()
end)()
local tweenVal = Instance.new("NumberValue")
print(dataTable[videoViews])
local tween1 = tweenService:Create(tweenVal, numberTweenInfo, {Value = dataTable["vid"..stat]})
print(tweenVal.Value)
Here is what i’m trying to show.
robloxapp-20240929-0841291.wmv (622.2 KB)
How can i fix this??