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

How do I make a GUI dissapear OnTouch?

Asked by 10 years ago

I tried

function game.Workspace.StarterGui.ScreenGui: destroy(OnTouch)
end

How can I fix this?

1 answer

Log in to vote
0
Answered by 10 years ago

If you're trying to remove the GUI from the player that touched the brick, then this is how you would do it:

function onTouch(Obj)
    if Obj.Parent:FindFirstChild("Humanoid") then
        local Player = game.Players:GetPlayerFromCharacter(Obj.Parent)
        if Player then
            if Player.PlayerGui:FindFirstChild("PUT GUI NAME HERE") then
                Player.PlayerGui["PUT GUI NAME HERE"]:Destroy()
            end
        end
    end
end
Game.Workspace.Part.Touched:connect(onTouch) --Change "Game.Workspace.Part" to what object you want the player to touch

Hope this helped!

0
Thanks :D Chromathyst 10 — 10y
Ad

Answer this question