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

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

Asked by 5 years ago
Edited 5 years ago

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!

0
Nothing wrong to do with indents btw TrueFalses -15 — 5y
0
Um please put it as the “lua code” format and I might be able to help you. 123nabilben123 499 — 5y
0
Sorry, alright. I am new here so I don't know how that functions xD, ima try right now. TrueFalses -15 — 5y
0
there we go. TrueFalses -15 — 5y

2 answers

Log in to vote
0
Answered by 5 years ago

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.

0
Also, delete line 13 on your script. Idk why you added a second time "userId=..pl.UserId..&width=420&height=420&format=png" TheRealPotatoChips 793 — 5y
Ad
Log in to vote
0
Answered by 5 years ago

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

Answer this question