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

A Char changer script?

Asked by 11 years ago

I want to make a script that will help me change people into a char when they join the game. This one is not working. Put this as a script.

01function Intialize(character)
02    for i, child in pairs(script:GetChildren()) do
03        if child.className == "Script" or child.className == "LocalScript" then
04            local c = child:Clone()
05            c.Parent = character
06            c.Disabled = false
07        end
08    end
09end
10 
11function Apply(obj)
12    if obj.className == "Humanoid" and obj.Health > 0 and obj.MaxHealth > 0 then
13        Intialize(obj.Parent)
14    end
15    for i, child in pairs(obj:GetChildren()) do
View all 21 lines...

Put this inside that script as a regular script.

01wait()
02 
03ch = script.Parent
04set = game.Workspace --This MUST be the original area.
05id = "Alar Knight of Splintered Skies" --Do NOT Mess with it!!! Leave the next 14 lines alone.
06parts = {"Right Arm", "Left Arm", "Right Leg","Left Leg","Torso","hats"}
07names = {"ra","la","rl","ll","ts","ht"}
08 
09wait()
10 
11function CloneMesh(name)
12    local child = set:FindFirstChild(id .. " " .. name)
13    local result = nil
14    if child ~= nil and child.className == "CharacterMesh" then --Leave alone. Must be "CharacterMesh"
15        result = child:Clone()
View all 46 lines...

1 answer

Log in to vote
0
Answered by 11 years ago

Any output? Also I'm not sure but when a Player respawns in a game, their character model never disappears so. If I were you I would try something like.

01function Respawn(prop,player)
02    if prop == "Character" then
03        initialize(player)
04    end
05end
06 
07game.Players.PlayerAdded:(function(player)
08    initialize(player)
09    player.Changed:connect(function(prop) Respawn(prop,player))
10end)

It's always easier working from the player than the character because the character is removed and beaten up all the time. The player is a constant object.

0
But what's wrong with mines? I want to be able to change the package. therovic1 5 — 11y
0
I can't tell just looking at it but here is what I do to find an error. Start using pring("something") happened. Then look in the output to see what went wrong "Where it didn't print". Tell me where and I'll look at what part of your script didn't function. soaprocks2 75 — 11y
Ad

Answer this question