This script is meant to fire (which it does in studio) when hitting specifically named objects and to play a sound as well as particles when hitting them, Nothing seems that complex here so why is it yet again only working in studio?

The block this is in is stored locally (moved into the Workspace via local script).

local enabled = true
function onTouched(hit)
	if enabled == true and
		hit.Name == "Object" or hit.Name == "Barrier" then
		enabled = false
		script.Parent.Particles.Rate = 250
			local Copy = script.Particles:Clone()
			Copy.Parent = hit
			Copy.Remover.Disabled = false
			wait(0.1)
		script.Sound:Play()
		script.Parent.Particles.Rate = 0
		enabled = true
	end
end


Connection = script.Parent.Touched:Connect(onTouched)

2 comments

0

moving it to workspace via a local script isn't going to replicate to the server

0

^^^^ make it a regular script my friend