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

how do I get this bit of thee script to work properly?

local Brick = script.Parent.Parent.Parent
local Picture = script.Parent.UserImage
local User = script.Parent.Username
function onTouch(Object)
	local Character = Object.Parent:FindFirstChild("Humanoid")
	if (Character ~= nil)then
		local Player = 
		game.Players:GetPlayerFromCharacter(Object.Parent)
		if (Player ~= nil)then
			Picture.Image = "http://www.roblox.com/User.aspx?ID="..Player.userId
			User.Text = Player.Name
		end
	end
end
script.Parent.Parent.Parent.Touched:connect(onTouch)

""

if (Player ~= nil)then
			Picture.Image = "http://www.roblox.com/User.aspx?ID="..Player.userId
			User.Text = Player.Name

"" I can't get this bit to work! Please help me, Thanks!

1 answer

✓ Accepted answer

You need to use the correct format for getting the player's character image. To do this, we'll use:

"http://www.roblox.com/Thumbs/Avatar.ashx?x=200&y=200&Format=Png&username="..Player.Name

So let's insert this into the script:

local Brick = script.Parent.Parent.Parent
local Picture = script.Parent.UserImage
local User = script.Parent.Username
function onTouch(Object)
	local Character = Object.Parent:FindFirstChild("Humanoid")
	if (Character ~= nil)then
		local Player = 
		game.Players:GetPlayerFromCharacter(Object.Parent)
		if (Player ~= nil)then
			Picture.Image = "http://www.roblox.com/Thumbs/Avatar.ashx?x=200&y=200&Format=Png&username="..Player.Name
			User.Text = Player.Name
		end
	end
end

script.Parent.Parent.Parent.Touched:connect(onTouch)

Anyways, it should work now, as I did test it. If not, or if you have any further questions/problems, please leave a comment below. Hope I helped :P

5 comments

0

Well, thanks for no feedback.

0

Took the words right out of my keyboard...that was exactly what I was going to say.

0

My comment or answer on his question?

0

Thanks, Sorry I just viewed this, I was doing Revision for my exams :P thanks dude

0

Lol, sorry, no problem. DId this work for you, or have you not tested it?

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