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

Why is my script not working?

Asked by
IcyEvil 260 Moderation Voter
9 years ago

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
0
Also, there are no errors, It just doesnt work. IcyEvil 260 — 9y

1 answer

Log in to vote
0
Answered by
Shawnyg 4330 Trusted Badge of Merit Snack Break Moderation Voter Community Moderator
9 years ago

Replace line 18 with

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

You don't need the for loop btw.

Ad

Answer this question