I have tried everything but nothing works. All I want is to fix this script. I only want a GUI to appear when I sit in a seat. A certain seat. Please help

local gui = script.Parent:FindFirstChild("MessageGui") -- Your Gui Name Here
--Change all "MessageGui" to your Gui Name

script.Parent.Touched:connect(function(hit)
	if hit.Parent ~= nAil then
		local player = game.Players:GetPlayerFromCharacter(hit.Parent)
		if hit.Parent:FindFirstChild("Humanoid") ~= nil then
			hit.Parent.Humanoid.Seated:connect(function(active, seat)
				if player ~= nil then
					if active == true and seat == script.Parent then
						if player.PlayerGui:FindFirstChild("MessageGui")== nil then
							gui:Clone().Parent = player.PlayerGui
						end
					elseif active ~= true and seat ~= script.Parent then
						if player.PlayerGui:FindFirstChild("MessageGui") ~= nil then
							player.PlayerGui:FindFirstChild("MessageGui"):Destroy()
						end
					end
				end
			end)
		end
	end
end)

Whats wrong?

Note: Seat is an anchored model

1 comment

0

You stated in your previous question you couldn’t post the script because it wasn’t yours.