Log in to vote
0

Help with messages?

Asked by 7 years ago

Is this how it would be?

H = game.Workspace.Part

local debounce = true
function onTouch(Part)
if debounce and Button.Parent:FindFirstChild("Humanoid") and Button.Parent.Name == game.Players:findFirstChild(Button.Parent.Name) then debounce = false
function onTouch(Part)
Instance.new("Message", game.Workspace.Part)
wait()
H.Message.Text("You can pass.")
end

script.Parent.Touched:connect(onTouch)

3 answers

Log in to vote
1
Answered by 7 years ago

To some extent, yes. But you need to remove the message after a small while, otherwise your game will get message spam. You may even want to add intervals between when the message can be activated or not.

--Example:

enabled = true H = game.Workspace.Part

function onTouch(Part) if enabled == true then enabled = false Instance.new("Message", game.Workspace.Part) wait() H.Message.Text("You can pass.") wait(1) H.Message:remove() enabled = true end end

script.Parent.Touched:connect(onTouch)

0
Yes, it is. geckohero17 55 — 7y
Ad
Log in to vote
1
Answered by 7 years ago

Wait so it is shown like this?

enabled = true

H = game.Workspace.Part

function onTouch(Part)
if enabled == true then
enabled = false
Instance.new("Message", game.Workspace.Part)
wait()
H.Message.Text("You can pass.")
wait(1)
H.Message:remove() enabled = true
end
end

script.Parent.Touched:connect(onTouch)
Log in to vote
1
Answered by 7 years ago

Pretty much, but I didn't even know H.Message.Text("You can pass.") works I though you could only say

H.Message.Text="You can pass."

Never forget the debounce!

Answer this question