Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

how can i change this destroy script so it only destroys for the person who touched it?

here is the script that makes the block destroy and it also gives the player who touches it money

local db = true
script.Parent.Touched:Connect(function(hit)
	if hit.Parent:FindFirstChild("Humanoid") ~= nil then
		if db == true then
			db = false
			script.Parent.Transparency = 1
			local player = game.Players:GetPlayerFromCharacter(hit.Parent)
			player.leaderstats.PowerBlocks.Value = player.leaderstats.PowerBlocks.Value + 1
		end
	end
end)

i need to make it so it only disappears for the person who touched it

thanks

2 comments

0

if this is a server script, then you'd need to use remote events for the client to destroy the brick

0

TouchEnded

1 answer

✓ Accepted answer

Put that entire script into a local script in the part. It will also make it easier because you can use LocalPlayer aswell then.

This discussion is preserved as it was. New answers, comments, and votes are closed.