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.
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!