Im working on when u click on a part, it does particles. (like most simulators, pet sim etc)
The way i found out how to do it is making particle emitter enabled when u click on rate 100 for 0.1 second and then disabling it.
It does not turn on or off
local cooldown = false
script.Parent.MouseClick:Connect(function()
local CurrentHp = script.Parent.Parent:GetAttribute("Hp")
if cooldown == false then
-- removing and show hp
cooldown = true
local NewHp = CurrentHp - 1
script.Parent.Parent:SetAttribute("Hp", NewHp)
script.Parent.Parent.BillboardGui.TextLabel.Text = NewHp .. "/10"
if NewHp == 0 then
script.Parent.Parent:Destroy()
end
--particle
local wavespart = script.Parent.Parent.Waves
local waveparticles = {
wavespart.Wave1,
wavespart.Wave2,
wavespart.Wave3
}
for i,v in waveparticles do
v.Enabled = true
wait(.1)
v.Enabled = false
print(v)
end
--cooldown = false
wait(0.4)
cooldown = false
end
end)
script.Parent.MouseHoverEnter:Connect(function()
script.Parent.Parent.Highlight.Enabled = true
end)
script.Parent.MouseHoverLeave:Connect(function()
script.Parent.Parent.Highlight.Enabled = false
end)
That is the entire script. I used a table to do it quickly and when doing
print(v) it does link to the correct one.