Im planning on making an area title drop down whenever you touch an invisible noncollideable part.
The key result is for when i enter the part, the gui drops down once. and only once, and then when i leave the part then come back to it again, it appears, but for me its not working at all! I tried multiple functions but it just wont come to me.
-- Replace "Part" with the name of your non-collidable part
local nonCollideablePart = game.Workspace.AreaTitles["Crash Site"]
-- Replace "Gui" with the name of your GUI element
local gui = game.Players.LocalPlayer.PlayerGui.AreaTitles
local frame = gui.Frame
-- Replace "TweenInfo.new(1)" with your preferred tween duration and easing style
local tweenInfo = TweenInfo.new(1, Enum.EasingStyle.Quad, Enum.EasingDirection.Out)
-- Replace "areaName" with the name of the area you want to display
local areaName = "Crash Site"
local description = "A small island with a single eggdog and the wreckage of a space shuttle."
-- Create the tweens
local guiTweenShow = game:GetService("TweenService"):Create(frame, tweenInfo, {Position = UDim2.new(0, 0, 0, 0)})
local guiTweenHide = game:GetService("TweenService"):Create(frame, tweenInfo, {Position = UDim2.new(0, 0, -1, 0)})
local delayTime = 3 -- Replace with the number of seconds you want to delay before hiding the GUI
local debounce = false
-- Function to display the GUI and start the tween
local function showAreaName()
if debounce == false and game.Players.LocalPlayer.Character and game.Players.LocalPlayer.Character:FindFirstChild("Humanoid") and nonCollideablePart:IsTouching(game.Players.LocalPlayer.Character.Humanoid) then
debounce = true
frame.Back.AreaTitle.Text = areaName
frame.Back.Description.Text = description
guiTweenShow:Play()
wait(delayTime)
guiTweenHide:Play()
wait(1)
debounce = false
end
end
-- Connect the show function to the non-collidable part's touch event
nonCollideablePart.Touched:Connect(showAreaName)
There is no IsTouching function i don’t know where you got that from but You can either use this :
-- Replace "Part" with the name of your non-collidable part
local nonCollideablePart = game.Workspace.AreaTitles["Crash Site"]
-- Replace "Gui" with the name of your GUI element
local gui = game.Players.LocalPlayer.PlayerGui.AreaTitles
local frame = gui.Frame
-- Replace "TweenInfo.new(1)" with your preferred tween duration and easing style
local tweenInfo = TweenInfo.new(1, Enum.EasingStyle.Quad, Enum.EasingDirection.Out)
-- Replace "areaName" with the name of the area you want to display
local areaName = "Crash Site"
local description = "A small island with a single eggdog and the wreckage of a space shuttle."
-- Create the tweens
local guiTweenShow = game:GetService("TweenService"):Create(frame, tweenInfo, {Position = UDim2.new(0, 0, 0, 0)})
local guiTweenHide = game:GetService("TweenService"):Create(frame, tweenInfo, {Position = UDim2.new(0, 0, -1, 0)})
local delayTime = 3 -- Replace with the number of seconds you want to delay before hiding the GUI
local debounce = false
-- Function to display the GUI and start the tween
local function showAreaName()
local Found = workspace:GetPartsInPart(nonCollideablePart)'
local Result = false
for i,v in pairs(Found) do
if v:FindFirstAncestorOfClass("Model") == game.Players.LocalPlayer.Character then
Result = true
end
end
if debounce == false and game.Players.LocalPlayer.Character and game.Players.LocalPlayer.Character:FindFirstChild("Humanoid") and Result == true then
debounce = true
frame.Back.AreaTitle.Text = areaName
frame.Back.Description.Text = description
guiTweenShow:Play()
wait(delayTime)
guiTweenHide:Play()
wait(1)
debounce = false
end
end
-- Connect the show function to the non-collidable part's touch event
nonCollideablePart.Touched:Connect(showAreaName)
Or this :
-- Replace "Part" with the name of your non-collidable part
local nonCollideablePart = game.Workspace.AreaTitles["Crash Site"]
-- Replace "Gui" with the name of your GUI element
local gui = game.Players.LocalPlayer.PlayerGui.AreaTitles
local frame = gui.Frame
-- Replace "TweenInfo.new(1)" with your preferred tween duration and easing style
local tweenInfo = TweenInfo.new(1, Enum.EasingStyle.Quad, Enum.EasingDirection.Out)
-- Replace "areaName" with the name of the area you want to display
local areaName = "Crash Site"
local description = "A small island with a single eggdog and the wreckage of a space shuttle."
-- Create the tweens
local guiTweenShow = game:GetService("TweenService"):Create(frame, tweenInfo, {Position = UDim2.new(0, 0, 0, 0)})
local guiTweenHide = game:GetService("TweenService"):Create(frame, tweenInfo, {Position = UDim2.new(0, 0, -1, 0)})
local delayTime = 3 -- Replace with the number of seconds you want to delay before hiding the GUI
local debounce = false
-- Function to display the GUI and start the tween
local function showAreaName(hit)
if debounce == false and game.Players.LocalPlayer.Character and game.Players.LocalPlayer.Character:FindFirstChild("Humanoid") and hit:FindFirstAncestorOfClass("Model") == game.Players.LocalPlayer.Character then
debounce = true
frame.Back.AreaTitle.Text = areaName
frame.Back.Description.Text = description
guiTweenShow:Play()
wait(delayTime)
guiTweenHide:Play()
wait(1)
debounce = false
end
end
-- Connect the show function to the non-collidable part's touch event
nonCollideablePart.Touched:Connect(showAreaName)
This is the crash site areatitle load zone, whenever i leave it, it shows the gui because right when i leave it theres a frame where it touches it at the same time, i want it so the gui shows once, doesn’t show when i jump or move around the place, and doesn’t show when i leave it, but when i get inside again, it shows it