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

hi i need to know How can i Activate an ClickDetector in a Brick, when a Dummy Die?

In my game, I want that when a Dummy dies, a ClickDetector is activated that is inside a Brick hidden in the map, this Brick gives a sum of 100 numbers to an Int Value in a special folder created within the Local Player, click the Brick does this action, but I would like that action to be executed when the Dummy dies, since I have tried to emulate the ClickDetector action inside the Dummy with a script, but it doesn't work please

2 comments

0

pls help me ; (

0

please ;u

1 answer

You can create one function that is then triggered by either clicking the brick, or dying.

local function SampleFunction(player)
	print(player.Name)
end

ClickDetector.MouseClick:Connect(SampleFunction)

game:GetService('Players').PlayerAdded:Connect(function(player)
	player.CharacterAdded:Connect(function(character)
		character:WaitForChild("Humanoid").Died:Connect(function()
			SampleFunction(player)
		end)
	end)
end)

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