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

Why is my script not working?

Im trying to make it to where its Like murder Mysteries Name Script, Except it is a part, That is inserted into a players head, And that part has a ScreenGui, and on the Gui it has Text, But I want it to select a random name to put In the text.

Names = {"Sarah","Paul","Michael","Heather","Kevin","India"}
for i,v in pairs(Names) do
	c = v
end

for i,v in pairs(game.Players:GetChildren()) do
	b = Instance.new("Part", v.Character.Head)
	g = Instance.new("SurfaceGui", v.Character.Head.b)
	t = Instance.new("TextLabel", v.Character.Head.b.g)
b.Size = Vector3.new(3.8, 2.6, 0.8)
b.Position = Vector3.new(44.4, 7.54, -43.25)
b.CanCollide = false
b.Transparency = 1
t.BackgroundTransparency = 1
t.Size = Vector3.new{"0,800"},{"0,600"}
t.Font = "Legacy"
t.FontSize = "Size48"
t.Text = math.random(c)

end

1 comment

0

Also, there are no errors, It just doesnt work.

1 answer

Replace line 18 with

t.Text = Names[math.random(#Names)]

You don't need the for loop btw.

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