Im thinking about making a game that makes it to where when you walk a part appears behind your character such as in murder mystery
COMMUNITY QUESTION
What Service or type of script is used to make a "part" appear behind your character when he walks?
2 answers
I would recommend that you have a LocalScript in every player that makes it so that every 5 or so seconds, a small part is made where their feet are, and then 25 seconds later, the part is destroyed.
Example:
wait();
script:destroy();--// Anti Death Removal
local Player=game:service'Players'.localPlayer;
local TrailSize=2;--// The trail size. Can be changed.
while(wait(5))do--// Do this every 5 seconds
local Character=Player.Character;
if(
Character--// If they have a character
and Character.Parent=workspace--// If the character is in the workspace ( prevents errors from falling off the base )
and Character:findFirstChild'Right Leg'--// If they have a right leg
and Character:findFirstChild'Left Leg'--// If they have a left leg
and Character:findFirstChild'Humanoid'--// If they are a real character
and Character.Humanoid.Health>0--// If they are alive
and Character:findFirstChild'Torso';--// If they have a torso
and Vector3.new(
Character.Torso.Velocity.X,
0,
Character.Torso.Velocity.Z
).magnitude>=2--// If they are walking
)then
local Trail=Instance.new('Part',workspace);--// Create the trail part
Trail.Name='Trail: '..Player.Name;
Trail.formFactor=3;
Trail.CanCollide=false;
Trail.Anchored=true;
Trail.BrickColor=ChatColor.Get(Player.Name);--// *****
Trail.TopSurface,Trail.BottomSurface=0,0;
Trail.Size=Vector3.new(TrailSize,TrailSize/2,TrailSize);--// You can change this to represent the trail size.
Trail.CFrame=
CFrame.new(
Vector3.new().lerp(
Character['Right Leg'].CFrame.p,
Character['Left Leg'].CFrame.p,
.5
),
Character.Torso.CFrame.p--// Where the player's character is facing.
)
* CFrame.new(
0,
-Character['Right Leg'].CFrame.Y/2,--// In between the player's feet.
-2 --// A little bit back.
);
game:service'Debris':addItem(Trail,25);--// Removes the trail part after 25 seconds
end;
end;
***** Interesting ChatColor class found on NoliCAIKS' code snippet container. It gets the Player's chat color, which is determined by their name.
Oh! That is called pathfinding! Go to this link!
3 comments
0
ive done that but it doesnt work it doesnt cut off in certain "parts" like on murder mystery
0
Oh well... You have to code that and maybe before you start giving me a minus learn how to script...
0
He's asking a good question, and you're not helping.
This discussion is preserved as it was. New answers, comments, and votes are closed.

2 comments
When i play it in studio mode and walk around the baseplate nothing shows up. Do i have to be in Play Mode?
Is there an error? If so, it's because you did not put in the ChatColor module that I posted on my answer.