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

Text not randomizing when i join the game?

Asked by 4 years ago

so I want it that when you join the game the text randomizes between certain letters, I have done what should have worked and I see no problems with it but I need help with it

local text = script.Parent.Text
local Players = game:GetService("Players")

Players.PlayerAdded:Connect(function(player)
    text.Value = math.random("A", "B", "C", "D", "E")
end)
0
math.random requires a number value Gameplayer365247v2 1055 — 4y

1 answer

Log in to vote
2
Answered by 4 years ago

You should be using text.Text and you can only use math.random for numbers.

local text = script.Parent.Text
local Players = game:GetService("Players")
local myLetters = {"A", "B", "C", "D", "E"}

Players.PlayerAdded:Connect(function(player)
    text.Text = math.random(1,#myLetters)
end)

0
thank you so much DraconianSG 58 — 4y
Ad

Answer this question