Not sure what I am doing wrong, the code simply does nothing. I am trying to make it so when you step on the part called “questmesh” the Frame inside of questgui goes invisible (or its visibility is set to false). What is wrong with my script?
local part = game.Workspace.questmesh
local customframe = game.Players.LocalPlayer.Player.questgui.Frame
local function onPartTouched(otherPart)
-- Get the other part's parent
local partParent = otherPart.Parent
-- Look for a humanoid in the parent
local humanoid = partParent:FindFirstChildWhichIsA("Humanoid")
if humanoid then
-- Do something to the humanoid, like set its health to 0
customframe.Visible = false
end
end
part.Touched:Connect(onPartTouched)