|
| 22 Aug 2011 02:44 PM |
I am making a body stroller GUI. Press a button to go forward to the next body, and another to go back. There are separate buttons for the torso, arms, and legs. The script work but I am having trouble with loading up the bodies. Here is the script;
bodies = script.Parent.Parent.Database.Body:GetChildren() torsoIndex = math.random(1, #bodies) armIndex = math.random(1, #bodies) legIndex = math.random(1, #bodies) player = script.Parent.Parent.Parent.Parent.Parent
function delete(part) p = player.Character:GetChildren() for i=1,#p do if p[i].ClassName == "CharacterMesh" then if part == "Torso" and p[i].BodyPart == part then p[i]:remove() elseif part == "Arm" and p[i].BodyPart == "LeftArm" or "RightArm" then p[i]:remove() elseif part == "Leg" and p[i].BodyPart == "LeftLeg" or "RightLeg" then p[i]:remove() end end end end
function insert(dir, part) if dir == 1 then if part == "Torso" then index = torsoIndex elseif part == "Arm" then index = armIndex elseif part == "Leg" then index = legIndex end if index < #bodies then index = index+1 getfenv()[string.lower(part).."Index"] = index end else if index > 1 then index = index-1 getfenv()[string.lower(part).."Index"] = index end end p = game:GetService("InsertService"):LoadAsset(bodies[index].Value) q = p:GetChildren() for i=1,#q do if part == "Torso" and q[i].BodyPart ~= part then q[i]:remove() elseif part == "Arm" and q[i].BodyPart ~= "LeftArm" or "RightArm" then q[i]:remove() elseif part == "Leg" and q[i].BodyPart ~= "LeftLeg" or "RightLeg" then q[i]:remove() end w = q[i] wait(1) w.Parent = game.Workspace[player.Name] end end
delete("Torso"); delete("Arm"); delete("Leg"); insert(1, "Torso"); insert(1, "Arm"); insert(1, "Leg");
script.Parent.Parent.Visuals.Buttons.torsoNext.MouseButton1Down:connect(function () delete("Torso") insert(1, "Torso") end) script.Parent.Parent.Visuals.Buttons.torsoBack.MouseButton1Down:connect(function () delete("Torso") insert(0, "Torso") end) script.Parent.Parent.Visuals.Buttons.armNext.MouseButton1Down:connect(function () delete("Arm") insert(1, "Arm") end) script.Parent.Parent.Visuals.Buttons.armBack.MouseButton1Down:connect(function () delete("Arm") insert(0, "Arm") end) script.Parent.Parent.Visuals.Buttons.legNext.MouseButton1Down:connect(function () delete("Leg") insert(1, "Leg") end) script.Parent.Parent.Visuals.Buttons.legBack.MouseButton1Down:connect(function () delete("Leg") insert(0, "Leg") end)
It outputs something like;
httpGet http://www.roblox.com/Asset/?id=32357766 failed. Trying again. Error: GZip error 4, ZLib error 0, "http://www.roblox.com/Asset/?id=32357766". Elapsed time: 1.53008 - Content failed for http://www.roblox.com/Asset/?id=32357766 because GZip error 4, ZLib error 0, "http://www.roblox.com/Asset/?id=32357766"
|
|
|
| Report Abuse |
|
|
| |
|
gombob
|
  |
| Joined: 01 May 2008 |
| Total Posts: 5215 |
|
|
| 22 Aug 2011 03:10 PM |
p = game:GetService("InsertService"):LoadAsset(bodies[index].Value)
I think this might be the problem. If you want to insert something with "id=345565633" then you have to do do id = id - 1 so you get "id=345565632". |
|
|
| Report Abuse |
|
|
|
| 22 Aug 2011 03:18 PM |
| Sorry; I don't understand. So what should I do? |
|
|
| Report Abuse |
|
|
|
| 22 Aug 2011 03:19 PM |
| D'you mean p = game:GetService("InsertService"):LoadAsset(bodies[index].Value-1)? |
|
|
| Report Abuse |
|
|
|
| 22 Aug 2011 03:24 PM |
Just tried that and it's loading something else ¬_¬
Please! Somebody! |
|
|
| Report Abuse |
|
|
| |
|
| |
|
| |
|
| |
|
|
| 24 Aug 2011 09:31 AM |
| If your trying to load body parts for a character changer, why not have an in-game directory of all the body parts, from there have your code extract a clone of the body parts into the character? I might not be understanding what you want exactly... |
|
|
| Report Abuse |
|
|
|
| 24 Aug 2011 10:10 AM |
| Yes, I was afraid I was going to have to do that. Thank you for your time anyway... |
|
|
| Report Abuse |
|
|