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

Why does this skin color gui script not work?

I have a character customization GUI I'm working on and a skin color section. Inside a scrolling frame there are skin tone squares. Each square is a image button and the image is the color of the skin I want. The first skin color I started on was Br.yellowish orange. Here is the local script (I have tried both kinds of scripts but I thought local would be best because it has access to local player) inside the image button. (That should change the players skin color to Br.yellowish orange)

local button = script.Parent

button.MouseButton1Down:connect(function(plr)
	local name = plr.Name
local playerinplayers = game.Players:FindFirstChild(plr.Name)
if playerinplayers ~= nil then
playerinplayers.CanLoadCharacterAppearance = false
plr.Head.face.Texture = "rbxassetid://156071940"
local bodycolors = Instance.new("BodyColors", plr)
bodycolors.RightArmColor = BrickColor.new("Br.yellowish orange")
bodycolors.LeftArmColor = BrickColor.new("Br.yellowish orange")
bodycolors.LeftLegColor = BrickColor.new("Br.yellowish orange")
bodycolors.RightLegColor = BrickColor.new("Br.yellowish orange")
bodycolors.TorsoColor = BrickColor.new("Br.yellowish orange")
bodycolors.HeadColor = BrickColor.new("Br.yellowish orange")
end
end)

2 answers

✓ Accepted answer

Adding onto what FlaminSparrow said,

MouseButton1Down does not return the player, it returns the mouse position. You should never use MouseButton1Down unless you're in a LocalScript. So this needs to be modified for a LocalScript. And as FlaminSparrow said, "you need to put it into the player's character, not the player itself." This means on line 9, put the character instead of the player as the parent of body colors.

Good Luck

Im pretty sure that you need to put it into the player's character, not the player itself.

Ps: How to comment on people's questions?

2 comments

0

I added onto your great answer. Also, you need 5 reputation in order to comment. You're almost there. Good Luck!

0

ty

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