Enabling Particles

I just wanted to make a particle become enabled once the player touches a part. The thing is the particle emitter is inside one of the players parts. In this case the particle emitter that I want to become enabled is the “Yellow” particle emitter in the players head.

Screenshot (822)

Here is the script that I have so far that is not giving me any errors but is not working.

local part = script.Parent
local player = game.Players.LocalPlayer.Character 

part.Touched:Connect(function(hit)
	if hit.Parent:FindFirstChildWhichIsA('Humanoid') then
		player.Head.LowerBeak.Yellow.Enabled = true
		wait(3)
		player.Head.LowerBeak.Yellow.Enabled = false
	end
end)

Thanks

1 Like

Get the plr like
local plr = game.Players:GetPlayerFromCharacter(hit.Parent)

1 Like

Hello, this is a local script. Use a script for the touched function.

local part = script.Parent

part.Touched:Connect(function(hit)
       if hit.Parent:FindFirstChildWhichIsA('Humanoid') then
              local character = game.Players:FindFirstChild(hit.Parent.Name)
              -- do ur stuff here
       end
end)

If you just want the particle emitter to apply to the client, use a remote event with the :FireClient(plr) function.

2 Likes

Thanks, but it doesn’t seem to be working. Its also not giving me any errors.

Here is what im using in a local script:

local part = script.Parent

part.Touched:Connect(function(hit)
	if hit.Parent:FindFirstChildWhichIsA('Humanoid') then
		local character = game.Players:FindFirstChild(hit.Parent.Name)
		character.Head.LowerBeak.Yellow.Enabled = true
		wait(3)
		character.Head.LowerBeak.Yellow.Enabled = false
	end
end)

Its giving an error "Head is not a valid member of Player “Players.naderbocker2”.

That’s because in character you are doing hit.Parent.Name not hit.Parent

Also, you can’t do touched event in the client, it should be in the server

1 Like

So what would I change to get different results? Also thanks

What do you want to change? This to the server? Use RemoteEvents or do it all in the server

1 Like

Well I want the particles to be enabled on just the person who touches the part. So I would think the server.

You mean that you want the player who touched the part can see the particles but only him?

1 Like

Oh no I want everyone to be able to see the particles.

1 Like

Ohhh ok, change the local script to a script, and make sure to reference the “Part” variable right, that’s all

Also, i suggest you to use a Debounce because touched event is really bad and it will fire multiple times

What you need is to add a script (not local) into a part that you wish the player to touch just like @ItsRayQwQ said. You were on the right page with part.touched however, you do NOT need the local player for this. In the touched:Connect(Function(hit)), hit is a variable for whatever instance has touched the object. Assuming that the play will walk on the part, this would mean that the hit variable would be referencing to the foot of the user. The feet of any character is always a descendant of the character meaning that you can use hit.Parent to reference the players character. After all of that, you can write something along these lines

local part = script.Parent -- Assuming this script is in the part

part.touched:Connect(function(hit)
     if hit.Parent:FindFirstChild("Humanoid") then -- I may be wrong here
          local Character = hit.Parent
          
          Character.LowerBeak.Yellow.etc
     end
end)

Please reach out for any questions

Actually, that’s fine, because it will check if the hitted instance has a Humanoid, so that means this is a character

Thanks for that suggestion, I will include that. Also thanks for your help.