Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

Is there a function with surface GUIs that allow you to click them and activate an event?

Asked by 10 years ago

If so, how? If you could help that'd be wonderful.

1 answer

Log in to vote
1
Answered by 10 years ago

No, but you could insert in a ClickDetector which would work just as well. Lets say that the part the SurfaceGui is adorned to is the scripts parent:

local Obj = script.Parent
local Clicker = Instance.new("ClickDetector")
Clicker.MaxActivationDistance = 1/0
Clicker.Parent = Obj

Clicker.MouseClick:connect(function(Player)
    --What you want to happen here
end)

This would put the ClickDetector in the part that the SurfaceGui is adorned to, then you can put what you want to happen where I put the comment.

Ad

Answer this question