Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

Random Value's Dosen't work why just says the number not the text why?

I am making a random text maker like it isnt the same text every time you get a mission it is random what mission you get i want it to take the info from a value in the replicatedstorage like Ob1, Ob2 they have the vaule like get a gun or so all the objectives are different but i cant get it to work.

So this is the script i have for now.

local sc = script.Parent
local MainFrame = sc.MainFrame
local Rep = game.ReplicatedStorage.Objectives

local Texts = {Rep.Ob1.Value, Rep.Ob2.Value, Rep.Ob3.Value, Rep.Ob4.Value, Rep.Ob5.Value}

MainFrame.Ob1.Text = math.random(1,#Texts)

1 answer

Hello.

The issue is,you are assigning the Text of the Ob1 object inside of 'MainFrame' to a random number.

Here is the fixed lines of code:

MainFrame.Ob1.Text = Texts[math.random(1,#Texts)]

Make sure to mark this as the answer if it is what you were looking for!

2 comments

0

Thanks it says the text now but it just takes the first one "Rep.Ob1.Value"

0

math.random() loves the number 1 for some reason.Also,please mark this as the answer.

This discussion is preserved as it was. New answers, comments, and votes are closed.