Help With Touch Event

I am trying to make a script where a ball hits a part and when it does hit, the ball disappears and a particle turn on.

I have two of this scripts each in a part. The problem is when the ball hits that part, both of the scripts activate.

How do I fix this

-- SERVER SCRIPT LOCATED IN O
-- Get a reference to the ball and particle effect
---> veriables
local ball = game.Workspace:WaitForChild("Ball")
local particle = script.Parent.Attachment.ParticleEmitter

---> main
function onTouch()
	if (ball ~=nil) then
		-- Turn on the particle effect
		particle:Clear()
		particle:Emit(10)
		wait(1)
		-- Disable the ball's visibility
		ball.Transparency = 1
		ball.Highlight.OutlineTransparency = 1
	end
end

-- Connect the collision function to the ball
ball.Touched:Connect(onTouch)
1 Like

I’m not sure I completely understand. Are you saying the problem is that both of the scripts activate rather than just one? If yes, why not just use one script?

1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.