I'm not sure if i'm doing correctly but I made lots of errors here, I would need help on how to fix this for my game.
script.Parent.Touched:connect(function() script.Parent.BillboardGui.Enabled = true Mouse.KeyDown:connect(function(key) if (key == "e") then script.Parent.BillboardGui.TextBox.Text = "Here's help." wait(5) script.Parent.BillboardGui.TextBox.Text = "Press |E| for help" end end) while script.Parent.TouchEnded:connect(function() script.Parent.BillboardGui.Enabled = false end end)
I can't make it work somehow.
Getting user input from the mouse is deprecated, like I said for the millionth time. Instead, use UserInputService. For anyone saying that wait() is not deprecated, yes it is. It is crossed out.
script.Parent.Touched:Connect(function() --:connect is deprecated, use :Connect script.Parent.BillboardGui.Enabled = true game:GetService('UserInputService').InputBegan:Connect(function(key) if key.KeyCode == Enum.KeyCode.E then script.Parent.BillboardGui.TextBox.Text = "Here's help." Wait(5) --wait() is deprecated, use Wait() script.Parent.BillboardGui.TextBox.Text = "Press |E| for help" end) end)
Also, do not use loops to listen for events. Just, just unnecessary.
script.Parent.TouchEnded:connect(function() script.Parent.BillboardGui.Enabled = false end
Also, do NOT use space to indent. Tab is quicker.