local players = game:GetService("Players")
function onTouched(part)
local player = players:GetPlayerFromCharacter(part.Parent) ~~~~~~~~~~~~~~~~~
if player then
local abzx = player.PlayerGui.Objective1.Frame
abzx:Destroy()
end
end
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?
function onTouched(part) local player = game.Players:GetPlayerFromCharacter(part.Parent) if part.Parent:findFirstChild("Humanoid") then local abzx = player.PlayerGui.Objective1.Frame abzx:Destroy() end end script.Parent.Touched:connect(onTouched)
It should work :) I wish I helped You