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

How to make a message appear when a person touches a part(door)?

How do you make a message appear when a person touches a part. Here is my current script,

local door = game.Workspace.Door
function onTouchM(obj)
	door.Touched:connect(function()
		msg = Instance.new("Message", game.Workspace)
		msg.Text = "..userID..Has Found The Door"
		wait(5)
		msg.Text:Destroy()
	end)
end

Help plz. :) Note: this is a localScript in workspace and not in anything else. It is not in the part(door). Just lying around in workspace.

1 answer

✓ Accepted answer

Well, you kind of messed up on the concatenation and not everything that hits the brick will be a player.

door = game.Workspace.Door
door.Touched:connect(function(hit)
	if hit.Parent and game.Players:GetPlayerFromCharacter(hit.Parent) then
		p = game.Players:GetPlayerFromCharacter(hit.Parent)
		m = Instance.new("Message", Workspace)
		m.Text = p.Name.." has found the door."
		wait(5)
		m:Destroy()
	end
end)

~ Thank me by accepting this answer/bumping up my reputation!

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