First, I set a variable called touch to see if the player has already touched the part
local touch = false
Next i used .Touched to see if the player touched the Part.
script.Parent.Touched:Connect(function()
Then after that, i saw if touch equaled false
if touch == false then
I created a new instance "ParticleEmitter" and put a wait(3) then destroyed it and also put touch to be equal to true
local conf = Instance.new("ParticleEmitter")
conf.Parent = script.Parent
touch = true
wait(3)
script.Parent:FindFirstChild("ParticleEmitter"):Destroy()
So, it should end up like this
local touch = false
script.Parent.Touched:Connect(function()
if touch == false
then
local conf = Instance.new("ParticleEmitter")
conf.Parent = script.Parent
touch = true
wait(3)
script.Parent:FindFirstChild("ParticleEmitter"):Destroy()
end
end)
1 comment
you should use script.Parent.Touched:Connect(function()