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

What Service or type of script is used to make a "part" appear behind your character when he walks?

Asked by 9 years ago

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

2 answers

Log in to vote
0
Answered by
Diitto 230 Moderation Voter
9 years ago

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.

0
When i play it in studio mode and walk around the baseplate nothing shows up. Do i have to be in Play Mode? iThunderStrike24 0 — 9y
0
Is there an error? If so, it's because you did not put in the ChatColor module that I posted on my answer. Diitto 230 — 9y
Ad
Log in to vote
-2
Answered by 9 years ago

Oh! That is called pathfinding! Go to this link!

http://wiki.roblox.com/index.php?title=Pathfinding

0
ive done that but it doesnt work it doesnt cut off in certain "parts" like on murder mystery iThunderStrike24 0 — 9y
0
Oh well... You have to code that and maybe before you start giving me a minus learn how to script... fualtyhellboy 5 — 9y
0
He's asking a good question, and you're not helping. EzraNehemiah_TF2 3552 — 9y

Answer this question