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

Change player into model onentered?

Asked by
Hero_ic 502 Moderation Voter
9 years ago

So i'm working on a game where I want you to automatically onentered change the player into a model i made which i inserted an humanoid and head object into.

I was wondering if there is a way to pull this off? basically what i'm trying to say is how to change the player to a different object. I've been looking this up over and over and found nothing. :/

Model. http://i.imgur.com/CCFfVzH.png

0
What's your script so far? Redbullusa 1580 — 9y
0
Here is the script. http://i.imgur.com/Rlvyeye.png Hero_ic 502 — 9y
0
Did you set your Part0 and Part1 to the corresponding body parts as shown in the default Robloxian character object? There's DaMrNelson's plugin to do that. Redbullusa 1580 — 9y
0
What is DrNelson's plugin? Hero_ic 502 — 9y
View all comments (3 more)
0
0
It works i finally got it to work thanks sooooooooo much :D your the best! Hero_ic 502 — 9y
0
You're welcome. :D Redbullusa 1580 — 9y

1 answer

Log in to vote
2
Answered by
Redbullusa 1580 Moderation Voter
9 years ago

SHORT ANSWER: Upon entering the server, you could redefine the Character property in the Player instance.

LONG ANSWER: There are some guidelines you may need to follow to make a functional Character object.

SCRIPT

  • You need a server script with .PlayerAdded and .CharacterAdded, because this will be the fundamental element to transform the Character object.
-- Ideally, you should put this in game.ServerScriptService.
game.Players.PlayerAdded:connect(function(player)
    player.CharacterAdded:connect(function(character)
        -- This is where the magic happens.
    end)
end)
  • I've seen scripts where it does the transformation itself (i.e. re-positions and re-sizes the body parts for you), but I find it easier to make a base model for the Character object first and store it somewhere (ideally, game.ServerStorage).

CHARACTER

  • As mentioned before, store the Character object in a storage instance (skip this if you're just going to create a script for the transformation). Anchor all of the parts.

  • In order to sustain the life of your Character object, a head/torso MUST be connected (Motor6D) and a HumanoidRootPart MUST be present. Refer to the default Robloxian Character object and see where the Motor6D joint objects connect to.

  • In my experience, keeping a Humanoid object in the Character object in Studio never worked out, as I keep dying. So in your script, create a new Humanoid object onto the Character.


Now all you have to do is make a spawn point for your character (with CFrame), rename the Character object every time it spawns, and then you're pretty much done.

This is how you redefine a Character object, add the Humanoid object in, and rename your character:

-- If your Character object is in game.ServerStorage
newCharacter = game.ServerStorage.YourCharacterObject:Clone()
newCharacter.Parent = workspace
newCharacter.Name = Player.Name
Player.Character = newCharacter

Humanoid = Instance.new("Humanoid", newCharacter)

newCharacter.Archivable = false
0
Hello, your amazing script seems to be working but my new player seems to die and i can't seem to know if i got the objects right. :/ Hero_ic 502 — 9y
0
The objects in the model. http://i.imgur.com/lo41fv1.png Hero_ic 502 — 9y
0
It works it works! your the best I really mean it! :D Hero_ic 502 — 9y
Ad

Answer this question