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

Does anyone know how to make a particle trail and give it to the player when he touches a block? [closed]

Asked by
jttj99 0
7 years ago
Edited 7 years ago

I have tried multiple ways to make a particle trail system for the player when they touch the block, but unfortunately I have had no luck with making it. Can someone please help me make a particle trail system. It would be very helpful! (I was never really good at scripting in "Lua Script" anyway. I am still learning Info: These are ways that I tried to make a particle trail system, bu t they didn't work)

game.Players.PlayerAdded:connect(function(plr)
    local plrName = plr.Name
    plr.CharacterAdded:connect(function(char)
        local plrTorso = char:WaitForChild("Torso")
        local sTrail = Instance.new("ParticleEmitter")
        sTrail.Name = "TrailTest"
        sTrail.Parent = plrTorso
    end)
end)
0
Please know that we're not supposed to just make code for you. We're supposed to help you with code you've already made... macabe55101 38 — 7y
0
This didn't work? I don't see anything wrong with this script. OldPalHappy 1477 — 7y
0
What's the purpose of variable "plrName?" It's not used anywhere in your code. And why're you using the PlayerAdded & CharacterAdded events when you're trying to have the particles emit when a player touches a part? TheeDeathCaster 2368 — 7y

Closed as Not Constructive by Goulstem, OldPalHappy, TheeDeathCaster, and GoldenPhysics

This question has been closed because it is not constructive to others or the asker. Most commonly, questions that are requests with no attempt from the asker to solve their problem will fall into this category.

Why was this question closed?

2 answers

Log in to vote
0
Answered by
RGRage 45
7 years ago
Edited 7 years ago

Use a Touched Event...

Part = script.Parent

Part.Touched:connect(function(hit) -- Use the touched event on a brick( hit refers to the part or brick that is hit by 'Part')
    if hit.Parent:FindFirstChild('Humanoid') then -- If there is a humanoid it is more likely to be a player
        local Player = game.Players:GetPlayerFromCharacter(hit.Parent) 
        if Player ~= nil then -- checks to see if the model or Parent is actually a player
            local Particles = Instance.new('ParticleEmitter') -- Creates the PartleEmitter inside of the Torso
            Particles.Parent = hit.Parent.Torso
        end
    end
end)

Remember to try and do your best to make a script before asking us to make one for you, because most of the time we will not make one from scratch.

Keep that in mind...

Ad
Log in to vote
0
Answered by 7 years ago
Edited 7 years ago
local Particles = script.Parent.ParticleEmitter --Defines the particles

script.Parent.Touched:connect(function(hit) --TouchedEvent
    wait() --waits
    local ParticlesClone = Particles:Clone() --Clones the particles
    ParticlesClone.Parent = hit --puts the particles inside of the object that hit the part

end) --closes the function

--]] 'hit' basically represents that part that is 'hitting' the brick. You can also change the 'hit(s)' other properties: 

        --  hit.Material = "Neon"       
        --  hit.BrickColor = BrickColor.Random()

--Copy this code into a script located inside a part or brick.