I made a script to make a frame invisible when a player touches it. But It doesn’t seem to be working.
script:
local player = game.Players.LocalPlayer
local part = script.Parent
local gui = player:WaitForChild(“PlayerGui”):WaitForChild(“DefeatBanditsGui”)
local frame = gui:WaitForChild(“FrameFirst”)
part.Touched:Connect(function()
if player:WaitForChild("Quest1").Value == 4 then
frame.Visible = false
end
Assuming this is from a local script, they don’t run in workspace.
-- Server script
script.Parent.Touched:Connect(function(hit)
if hit.Parent:FindFirstChild('Humanoid') ~= nil then
local player = game.Players:GetPlayerFromCharacter(hit.Parent) -- Player found from touch
local gui = player:WaitForChild('PlayerGui'):WaitForChild('DefeatBanditsGui')
local frame = gui:WaitForChild('FrameFirst')
if player:WaitForChild("Quest1").Value == 4 then
frame.Visible = false
end
end
end)