How to detect part touch only on client?

edit: i figured it out

I have about 100 small blocks, and whenever one of them gets touched by a player I want it to disappear, but ONLY on that player’s client.

I also want all 100 blocks to be reset at the same time later, so how can I do that?

edit: i figured it out

1 Like

If you figured it out, please reply to yourself explaining what you did and tag it as ‘answer’, this can help other people who bump into the same problem sometimes!

3 Likes

I found it out by putting local script inside of starter character scripts, and put this thanks to some help from Vioo:

local character = script.Parent

for _, v in pairs(character:GetChildren()) do
	if v:IsA("BasePart") then
		v.Touched:Connect(function(part)
			if part.Name == "FallingPart" then
				print("touched spleef")
			end
		end)
	end
end
2 Likes
local player = game.Players.LocalPlayer
local character = player.Character or player.CharacterAdded:Wait()
local debounce = false

for _, part in ipairs(character:GetChildren()) do
	if part:IsA("BasePart") then
		part.Touched:Connect(function(hit)
			if debounce then
				return
			end
			if hit.Parent.Name == player.Name then --ignore if character parts are touching eachother
				return
			end
			debounce = true
			print(player.Name.." touched "..hit.Name.."!")
			task.wait(2) --cooldown
			debounce = false
		end)
	end
end

I just created this exact same script for someone else in a different thread, as you mentioned it needs to go inside the StarterCharacterScripts folder.