local players = game:GetService("Players")
1 |
function onTouched(part)
1 |
1 | local player = players:GetPlayerFromCharacter(part.Parent) |
2 | ~~~~~~~~~~~~~~~~~ |
1 | if player then |
1 | local abzx = player.PlayerGui.Objective 1. Frame |
1 | abzx:Destroy() |
1 | end |
1 | end |
1 | script.Parent.Touched:connect(onTouched) |
~~~~~~~~~~~~~~~~~
The intended purpose of this piece of code is to remove a GUI once a brick has been touched, I know there are some codes which allow me to do this but I want to understand the concept before utilizing it. I have checked the error log and nothing shows up in relevance to this script. Can anyone help me?
1 | function onTouched(part) |
2 | local player = game.Players:GetPlayerFromCharacter(part.Parent) |
3 | if part.Parent:findFirstChild( "Humanoid" ) then |
4 | local abzx = player.PlayerGui.Objective 1. Frame |
5 | abzx:Destroy() |
6 | end |
7 | end |
8 | script.Parent.Touched:connect(onTouched) |
It should work :) I wish I helped You