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 5 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

1local text = script.Parent.Text
2local Players = game:GetService("Players")
3 
4Players.PlayerAdded:Connect(function(player)
5    text.Value = math.random("A", "B", "C", "D", "E")
6end)
0
math.random requires a number value Gameplayer365247v2 1055 — 5y

1 answer

Log in to vote
2
Answered by 5 years ago

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

1local text = script.Parent.Text
2local Players = game:GetService("Players")
3local myLetters = {"A", "B", "C", "D", "E"}
4 
5Players.PlayerAdded:Connect(function(player)
6    text.Text = math.random(1,#myLetters)
7end)
0
thank you so much DraconianSG 58 — 5y
Ad

Answer this question