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

How to make your character as someone?

Asked by 9 years ago

I want to know on how to prevent your character from being you. Like in the murder games, but I'm not into making murder games. So, I got this model of a hat. I want it to be the default hat of everyone who joins my place. If possible, also the clothing. I just want to know the things I have to do. I want to figure out and do it myself. Please help me. A basic script would also help.

1 answer

Log in to vote
2
Answered by
Validark 1580 Snack Break Moderation Voter
9 years ago

Well what I did is make a localscript and put it inside the StarterGui because that way the script will automatically run each time the player respawns.

--To modify the player, you may use the following code
game.Players.LocalPlayer.Character.Shirt --or whatever you want to access inside the Character

To give everyone a hat, you would want to clone it into the character. What I did in my script was have a model in the workspace where I stored all the things I want to clone over to the player.

I also used the following code to remove some of the unwanted contents the player spawns with

for a,c in pairs(game.Players.LocalPlayer.Character:GetChildren()) do --Make a list of all the things inside the LocalPlayer's Character. "a" is the index value and "c" is the actual element.
            if (c.className == "Hat") or (c.className == "CharacterMesh") then
            c:Destroy() --Get's rid of the hat or charactermesh
end

Here is an article on pairs loop if needed.

Hope you figure it out.

0
Where's the second end on the second chunk of code? fahmisack123 385 — 9y
0
It's fine. I think I figured it out. I'm experimenting the script so I could learn some more. Pacified 15 — 9y
0
Sorry, I cut it out and forgot to add it back in. Validark 1580 — 9y
Ad

Answer this question