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

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

Asked by
DevingDev 346 Moderation Voter
8 years ago

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

Log in to vote
2
Answered by 8 years ago

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!

0
Thanks it says the text now but it just takes the first one "Rep.Ob1.Value" DevingDev 346 — 8y
0
math.random() loves the number 1 for some reason.Also,please mark this as the answer. Reshiram110 147 — 8y
Ad

Answer this question