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

Why isn't this roblox random player talking system not working?

So here is the script..

local rng=math.random(1,#game.Players:GetChildren())
 local pl;
 local gui= Blah
 for i,v in pairs(game.Players:GetChildren()) do
      if i==rng then
       pl=v
     end
 end

 gui.TextLabel.Text=pl.Name
 gui.ImageLabel.Image=https://www.roblox.com/bust-thumbnail/image? 
 userId=..pl.UserId..&width=420&height=420&format=png
 userId=..pl.UserId..&width=420&height=420&format=png

Error from output: Players.TrueFalses.PlayerGui.LocalScript:11: Expected identifier when parsing method name, got '/'

Which came from the line :

gui.ImageLabel.Image=https:/<--error/www.roblox.com/bust-thumbnail/image?

Got marked red.

Please help!

4 comments

0

Nothing wrong to do with indents btw

0

Um please put it as the “lua code” format and I might be able to help you.

0

Sorry, alright. I am new here so I don't know how that functions xD, ima try right now.

0

there we go.

2 answers

✓ Accepted answer

Instead of doing this:

gui.ImageLabel.Image = https://www.roblox.com/bust-thumbnail/image?userId=..pl.UserId..&width=420&height=420&format=png

Do this:

gui.ImageLabel.Image = "https://www.roblox.com/bust-thumbnail/image?userId="..pl.UserId.."&width=420&height=420&format=png"

You have to add " ".

If this didn't help, comment on my answer what showed up in the output.

1 comment

0

Also, delete line 13 on your script. Idk why you added a second time "userId=..pl.UserId..&width=420&height=420&format=png"

Thanks, like this??

local rng=math.random(1,#game.Players:GetChildren()) local pl; local gui= "lol" for i,v in pairs(game.Players:GetChildren()) do if i==rng then pl=v end end

gui.TextLabel.Text=pl.Name gui.ImageLabel.Image = "https://www.roblox.com/bust-thumbnail/image?userId=" ..pl.UserId.."&width=420&height=420&format=png"

for naming the local gui, it only allows me to name it quoted " ", otherwise it becomes an error..

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