Problem: After getting the tag and the the UI goes away everything is fine but when I move agine the UI comes back up. How do I make it so the UI does not come back up?
--LOCAL SCRIPT IN STARTERGUI
---> variables
local Animator = game.Workspace.Map.Jobs.HitBoxes:WaitForChild("Animator")
---> main
Animator.Touched:Connect(function(Hit)
spawn(function()
if Hit.Parent:FindFirstChild("Humanoid") then
script.Parent.Parent.JobUI.AnimatorFrame.Visible = true
repeat task.wait() until (Animator.Position - Hit.Parent.HumanoidRootPart.Position).magnitude >= 12
script.Parent.Parent.JobUI.AnimatorFrame.Visible = false
end
end)
end)
the reason it shows up again, is because when you touch the hitbox it runs the “Animator.Touched” function, then it makes the UI visible again with script.Parent.Parent.JobUI.AnimatorFrame.Visible = true so you have to add script.Parent.Parent.JobUI.AnimatorFrame.Enabled = false so it doesnt become visible again
--LOCAL SCRIPT IN STARTERGUI
---> variables
local Animator = game.Workspace.Map.Jobs.HitBoxes:WaitForChild("Animator")
---> main
Animator.Touched:Connect(function(Hit)
spawn(function()
if Hit.Parent:FindFirstChild("Humanoid") then
script.Parent.Parent.JobUI.AnimatorFrame.Visible = true
repeat task.wait() until (Animator.Position - Hit.Parent.HumanoidRootPart.Position).magnitude >= 12
script.Parent.Parent.JobUI.AnimatorFrame.Visible = false
script.Parent.Parent.JobUI.AnimatorFrame.Enabled = false --just add this simple line and it should work
end
end)
end)
local Animator = game.Workspace.Map.Jobs.HitBoxes:WaitForChild("Animator")
local player = game.Players.LocalPlayer
local job = Instance.new("StringValue", player)
---> main
Animator.Touched:Connect(function(Hit)
spawn(function()
if Hit.Parent:FindFirstChild("Humanoid") then
if job.Value ~= "Animator" then
script.Parent.Parent.JobUI.AnimatorFrame.Visible = true
repeat task.wait() until (Animator.Position - Hit.Parent.HumanoidRootPart.Position).magnitude >= 12
script.Parent.Parent.JobUI.AnimatorFrame.Visible = false
job.Value = "Animator"
end
end
end)
end)
local Animator = game.Workspace.Map.Jobs.HitBoxes:WaitForChild("Animator")
local player = game.Players.LocalPlayer
local job = Instance.new("StringValue", player)
job.Name = "Job"
---> main
Animator.Touched:Connect(function(Hit)
spawn(function()
if Hit.Parent:FindFirstChild("Humanoid") then
if job.Value == "Animator" then
-- do nothing
else
script.Parent.Parent.JobUI.AnimatorFrame.Visible = true
repeat task.wait() until (Animator.Position - Hit.Parent.HumanoidRootPart.Position).magnitude >= 12
script.Parent.Parent.JobUI.AnimatorFrame.Visible = false
job.Value = "Animator"
end
end
end)
end)
--LOCAL SCRIPT IN STARTERGUI
---> variables
local Animator = game.Workspace.Map.Jobs.HitBoxes:WaitForChild("Animator")
---> main
Animator.Touched:Connect(function(Hit)
spawn(function()
if Hit.Parent:FindFirstChild("Humanoid") then
local headui = Hit.Parent.Head.HeadUI
if headui then
if headui.UI.JobUI.JobName.Text ~= "Animator" then
script.Parent.Parent.JobUI.AnimatorFrame.Visible = true
repeat task.wait() until (Animator.Position - Hit.Parent.HumanoidRootPart.Position).magnitude >= 12
script.Parent.Parent.JobUI.AnimatorFrame.Visible = false
headui.UI.JobUI.JobName.Text = "Animator"
end
end
end
end)
end)