````I've tried my old scripting but it doesn't work, I think they updated the coding in Roblox.~~~~~~~~~~~~~~~~~
01 | local msgText = "You need a key to continue." |
02 |
03 | script.Parent.Touched:connect( function (hit) |
04 | local findhum = hit.Parent:FindFirstChild( "Humanoid" ) |
05 | if findhum then |
06 | local player = game.Players:GetPlayerFromCharacter(hit.Parent) |
07 | local findm = player.PlayerGui:findFirstChild( "msg" ) |
08 | if not findm then |
09 | local msg = Instance.new( "Message" , player.PlayerGui) |
10 | msg.Text = msgText |
11 | msg.Name = "msg" |
12 | wait( 5 ) |
13 | msg:remove() |
14 | end |
15 | end |
16 | end ) |
It works, the message will display. You just forgot the part at the bottom. This might fix it!
01 | local msgText = "You need a key to continue." |
02 |
03 | script.Parent.Touched:connect( function (hit) |
04 | local findhum = hit.Parent:FindFirstChild( "Humanoid" ) |
05 | if findhum then |
06 | local player = game.Players:GetPlayerFromCharacter(hit.Parent) |
07 | local findm = player.PlayerGui:findFirstChild( "msg" ) |
08 | if not findm then |
09 | local msg = Instance.new( "Message" , player.PlayerGui) |
10 | msg.Text = msgText |
11 | msg.Name = "msg" |
12 | wait( 5 ) |
13 | msg:remove() |
14 | end |
15 | end |
16 | end |
17 |
18 | script.Parent.Touched:connect(onTouch) |
Let me know if it doesn't work.
Your problem is most likely this
1 | player.PlayerGui:findFirstChild( "msg" ) |
Find must be capitalized for this to work. If it doesn't then post the error you are getting in the output.