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

Why does this skin color gui script not work?

Asked by
blazar04 281 Moderation Voter
8 years ago

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

Log in to vote
0
Answered by 8 years ago

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

Ad
Log in to vote
1
Answered by 8 years ago

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?

0
I added onto your great answer. Also, you need 5 reputation in order to comment. You're almost there. Good Luck! User#11440 120 — 8y
0
ty FlaminSparrow 65 — 8y

Answer this question