generic image
Processing...
  • Games
  • Catalog
  • Develop
  • Robux
  • Search in Players
  • Search in Games
  • Search in Catalog
  • Search in Groups
  • Search in Library
  • Log In
  • Sign Up
  • Games
  • Catalog
  • Develop
  • Robux
   
ROBLOX Forum » Game Creation and Development » Game Design
Home Search
 

Re: Character creator not working

Previous Thread :: Next Thread 
BrockRocksYourSocks is not online. BrockRocksYourSocks
Joined: 22 Nov 2009
Total Posts: 5338
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 is not online. 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 is not online. 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 is not online. ParaText
Joined: 15 Aug 2016
Total Posts: 799
20 Aug 2016 07:05 PM
^
...?
This is Game Design... lol
Report Abuse
gun67 is not online. 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 is not online. 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 is not online. 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
Previous Thread :: Next Thread 
Page 1 of 1
 
 
ROBLOX Forum » Game Creation and Development » Game Design
   
 
   
  • About Us
  • Jobs
  • Blog
  • Parents
  • Help
  • Terms
  • Privacy

©2017 Roblox Corporation. Roblox, the Roblox logo, Robux, Bloxy, and Powering Imagination are among our registered and unregistered trademarks in the U.S. and other countries.



Progress
Starting Roblox...
Connecting to Players...
R R

Roblox is now loading. Get ready to play!

R R

You're moments away from getting into the game!

Click here for help

Check Remember my choice and click Launch Application in the dialog box above to join games faster in the future!

Gameplay sponsored by:
Loading 0% - Starting game...
Get more with Builders Club! Join Builders Club
Choose Your Avatar
I have an account
generic image