Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

How to make yourself spawn in with certain properties?

For my game I want to make it so that you can spawn in with certain properties. I understand how to spawn in with certain bodycolors, but I do not understand how to spawn in with a certain transparency or particle emitter attached to you, for example. Here is what I have done so far.

game.Workspace.ChildAdded:connect(function(plr)
local name = plr.Name
local playerinplayers = game.Players:FindFirstChild(plr.Name)
if playerinplayers ~= nil then
playerinplayers.CanLoadCharacterAppearance = false
plr.Head.face.Texture = "rbxassetid://28257733"
local bodycolors = Instance.new("BodyColors", plr)
bodycolors.RightArmColor = BrickColor.new("Mulberry")
bodycolors.LeftArmColor = BrickColor.new("Mulberry")
bodycolors.LeftLegColor = BrickColor.new("Mulberry")
bodycolors.RightLegColor = BrickColor.new("Mulberry")
bodycolors.TorsoColor = BrickColor.new("Mulberry")
bodycolors.HeadColor = BrickColor.new("Mulberry")
local particle = script.ParticleEmitter -- How can i spawn in a particle emitter and make it so that it is anchored to the player?
particle.LockedToPart = true
print("hi")
end
end)

2 answers

✓ Accepted answer

The concept of making changes to any object is always the same: Simply identify the object you want to change and then assign new values to its properties.

E.g. in your case, you can change the Head's transparency by doing:

plr.Head.Transparency = 0.5

If you want custom objects (such as ParticleEmitters) attached to an object, you can either create it from script or Clone() it from somewhere else. From what I understand, objects that are only created at run-time, and that do not exist in the world initially, such as bullets, should be stored in ServerStorage.

Apparently, ParticleEmitters do not have their own CFrame, so you must first add it as a child to a Part which will deliver the CFrame (which is necessary to actually position, scale and rotate an object). The steps are as follows:

  1. Create a new part.
  1. Set the part's `Transparency to 1 (so it is invisble)
  1. Disable the part's collisions (so it won't act as an invisible obstacle)
  1. Add whatever decorations you want to have as children to that part.
  1. Give the part a meaningful name, like CharacterDecorations
  1. Put it in ServerStorage

Now, you can easily add it to plr using Clone(), like so:

local decorations = game.ServerStorage.CharacterDecorations:Clone()
decorations.Parent = plr;
decorations.Position = plr.Torso.Position;

Done. Whatever you added to "decorations" will now be a part of the player. :)

1 comment

0

I can make the Head transparent, but not the other body parts

Disable the character auto load function.

Then Load the character in on your own <3

2 comments

0

I understand that but I do not understand how to spawn in as near transparent, or with particles

0

If you want particles you would create the desired affect, add it to the replicated storage. When you spawn you want to clone it and parent it to the Torso of the player. To turn a player invisible or transparent you wan to use a for loop.

This discussion is preserved as it was. New answers, comments, and votes are closed.