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

How do you detect you're character in workspace?

Im a little new to scripting, Im making an explode button that if you press it, it will play a sound that is inside you're character and can be also heard by other players and i don't know how to detect your character. Please help Thx

1 answer

✓ Accepted answer

You can use a ClickDectector.

Insert a ClickDetector inside of the part to press.

And insert a script inside of the part.

Use the MouseClick event for the ClickDetector (Once clicked by mouse, the event fires).

It also returns the player object so you can do

script.Parent.ClickDetector.MouseClick:Connect(function(player)
	local sound = Instance.new('Sound', player.Character) 
	sound.SoundId = Sound id here
	sound:Play()
	print("Sound is played inside of "..player.Name.."'s character!")
end)

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