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

Why does this script not work?

Its Supposed to be for a Murder Mystery Type game, Except made from Screen Guis on Invisible parts, It is not working for some reason though, No errors, Just doesnt work, Any reason why?

Script

Names = {"Sarah","Paul","Michael","Heather","Kevin","India"}
Colors = {"Really red","Really blue","Really black","Earth green","Cyan","Pink"}
 
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.Color = Colors[math.random(#Colors)]
t.Text = Names[math.random(#Names)]
if v.Character.Humanoid.Health == 0 then
v.Character.Head.b.g.t.Text = Names[math.random(#Names)]
end

1 answer

You forgot an end! Edit : (Multiple errors)

Try this ;

names = {"Sarah","Paul","Michael","Heather","Kevin","India"}


for i,v in pairs(game.Players:GetChildren()) do
if workspace:FindFirstChild(v.Name) then
c = BrickColor.Random()
local b = Instance.new("BillboardGui",v.Character.Head)
b.Size = UDim2.new(6,0,2,0) 
b.StudsOffset = Vector3.new(0,1.5,0)
local text = Instance.new("TextLabel",b) 
text.Size = UDim2.new(1,0,1,0) 
text.Text = names[math.random(1,#names)] 
text.TextColor3 = c.Color 
text.TextScaled = true text.BackgroundTransparency = 1
end
end



5 comments

0

still does nothing :c

0

Found another error. let me try to see what I can do.

0

Found multiple errors, fixing.

0

Try it now.

0

Also, if you was to use invisible parts, you'd have to weld the part to the characters head or somthing, as it just falls to the ground, and if this happend, so would the name as the Billboardgui is in the part.

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