|
| 20 Aug 2016 05:47 PM |
local player = script.Parent local charSettings = player.CharSettings local charValues = player.CharValues
local skinColors = {"Pastel brown", "Light orange", "Nougat", "Reddish brown"} local hairColors = {"Cool yellow", "Brown", "Reddish brown", "Bright orange", "Really black", "Medium stone grey"} local shirtColors = {"Bright red", "Bright blue", "Bright green", "Bright yellow", "Carnation pink", "White"} local hairs = {{"Normal", "Long", "Messy"}, {"NormalHair", "LongHair", "PonyTail"}}
local typeValue = charSettings.Gender local skinValue = charSettings.Skin local shirtValue = charSettings.Shirt local hatValue = charSettings.Hair local hcValue = charSettings.HairColor
local charTemplate = game.Workspace.CharacterTemplate
function changeCharValue(val, name) local cValue = charValues:FindFirstChild(name) if cValue ~= nil then cValue.Value = val end end
function changeHats(val, num) local newHairs = hairs[val] local newHair = game.ReplicatedStorage.Hats:FindFirstChild(newHairs[num]) if newHair ~= nil then changeCharValue(newHairs[num], "Hair") local backup = newHair:Clone() backup.Parent = charTemplate end end
function changeHairColor(val) local charHat = charTemplate:FindFirstChild("CHAR_HAIR") local newColor = BrickColor.new(hairColors[val]) if charHat ~= nil then charHat.BrickColor = newColor changeCharValue(newColor, "HairColors") end end
function changeSkinColor(val) local newColor = BrickColor.new(skinColors[val]) local head = charTemplate.Head local lArm = charTemplate:FindFirstChild("Left Arm") local rArm = charTemplate:FindFirstChild("Right Arm") local allParts = {head, lArm, rArm} for index, child in pairs(allParts) do child.BrickColor = newColor changeCharValue(newColor, "Skin") end end
function changeShirtColor(val) local newColor = BrickColor.new(shirtColors[val]) local torso = charTemplate.Torso torso.BrickColor = newColor changeCharValue(newColor, "Shirt") end
typeValue.Changed:connect(function(val) changeHats(typeValue.Value, hatValue.Value) end)
skinValue.Changed:connect(function(val) changeSkinColor(skinValue.Value) end)
shirtValue.Changed:connect(function(val) changeShirtColor(shirtValue.Value) end)
hatValue.Changed:connect(function(val) changeHats(typeValue.Value, hatValue.Value) end)
changeHats(1, 1)
This script is supposed to change different parts on the character template. However, hats aren't showing up and colors aren't changing. The output isn't telling me that there's anything wrong, so I don't know what's happening.
plz halp |
|
|
| Report Abuse |
|
|
ParaText
|
  |
| Joined: 15 Aug 2016 |
| Total Posts: 799 |
|
|
| 20 Aug 2016 06:59 PM |
1) This is the wrong subforum 2) Don't just paste your whole script, only paste what's most likely the source of error 3) If you don't know where the error is most likely coming from, then insert print lines and debug
|
|
|
| Report Abuse |
|
|
gun67
|
  |
| Joined: 17 Oct 2009 |
| Total Posts: 517 |
|
|
| 20 Aug 2016 07:02 PM |
@above actually its the right sub forum
Scripters This is the place for discussion about scripting. Anything about scripting that is not a help request or topic belongs here.
(Anything about scripting that is not a help request or topic belongs here.) |
|
|
| Report Abuse |
|
|
ParaText
|
  |
| Joined: 15 Aug 2016 |
| Total Posts: 799 |
|
|
| 20 Aug 2016 07:05 PM |
^ ...? This is Game Design... lol |
|
|
| Report Abuse |
|
|
gun67
|
  |
| Joined: 17 Oct 2009 |
| Total Posts: 517 |
|
|
| 20 Aug 2016 07:15 PM |
| You have a point but nowhere in the guidelines does it say no scripting requests in the game design forum and since they removed scripting helpers there no better place for his post. |
|
|
| Report Abuse |
|
|
pidgey
|
  |
| Joined: 16 Jan 2008 |
| Total Posts: 2739 |
|
|
| 20 Aug 2016 07:16 PM |
your 2darrays are not properly built and i suggest using a module for that kind of thing
https://www.roblox.com/My/Groups.aspx?gid=2893266 | pidgey is my name sh##posting is my game https://www.roblox.com/money-item?id=13127780 |
|
|
| Report Abuse |
|
|
ParaText
|
  |
| Joined: 15 Aug 2016 |
| Total Posts: 799 |
|
|
| 20 Aug 2016 07:25 PM |
@gun67 Yes, you do have a point. But, there is a reason why there's a subforum named 'Scripters'.
@Brock It seems that none of your connect lines are being triggered except for the one dealing with hats. |
|
|
| Report Abuse |
|
|