I tried
function game.Workspace.StarterGui.ScreenGui: destroy(OnTouch) end
How can I fix this?
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!