I am trying to make a script where if you touch a part UI come up. I have this for all of the parts but only the first function works. How do i make all of them work
local Animator = game.Workspace.Map.Jobs.HitBoxes:WaitForChild("Animator")
local Artist = game.Workspace.Map.Jobs.HitBoxes:WaitForChild("Artist")
local Builder = game.Workspace.Map.Jobs.HitBoxes:WaitForChild("Builder")
local ClothingDesigner = game.Workspace.Map.Jobs.HitBoxes:WaitForChild("ClothingDesiner")
local Composer = game.Workspace.Map.Jobs.HitBoxes:WaitForChild("Composer")
local Modeler = game.Workspace.Map.Jobs.HitBoxes:WaitForChild("Modeler")
local Scripter = game.Workspace.Map.Jobs.HitBoxes:WaitForChild("Scripter")
local UIDesigner= game.Workspace.Map.Jobs.HitBoxes:WaitForChild("UIDesigner")
Animator.Touched:Connect(function(Hit)
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)
Artist.Touched:Connect(function(Hit)
if Hit.Parent:FindFirstChild("Humanoid") then
script.Parent.Parent.JobUI.ArtistFrame.Visible = true
repeat task.wait() until (Animator.Position - Hit.Parent.HumanoidRootPart.Position).magnitude >= 12
script.Parent.Parent.JobUI.ArtistFrame.Visible = false
end
end)
Builder.Touched:Connect(function(Hit)
if Hit.Parent:FindFirstChild("Humanoid") then
script.Parent.Parent.JobUI.BuilderFrame.Visible = true
repeat task.wait() until (Animator.Position - Hit.Parent.HumanoidRootPart.Position).magnitude >= 12
script.Parent.Parent.JobUI.BuilderFrame.Visible = false
end
end)
ClothingDesigner.Touched:Connect(function(Hit)
if Hit.Parent:FindFirstChild("Humanoid") then
script.Parent.Parent.JobUI.ClothingFrame.Visible = true
repeat task.wait() until (Animator.Position - Hit.Parent.HumanoidRootPart.Position).magnitude >= 12
script.Parent.Parent.JobUI.ClothingFrame.Visible = false
end
end)
Composer.Touched:Connect(function(Hit)
if Hit.Parent:FindFirstChild("Humanoid") then
script.Parent.Parent.JobUI.ComposerFrame.Visible = true
repeat task.wait() until (Animator.Position - Hit.Parent.HumanoidRootPart.Position).magnitude >= 12
script.Parent.Parent.JobUI.ComposerFrame.Visible = false
end
end)
Modeler.Touched:Connect(function(Hit)
if Hit.Parent:FindFirstChild("Humanoid") then
script.Parent.Parent.JobUI.ModelerFrame.Visible = true
repeat task.wait() until (Animator.Position - Hit.Parent.HumanoidRootPart.Position).magnitude >= 12
script.Parent.Parent.JobUI.ModelerFrame.Visible = false
end
end)
Scripter.Touched:Connect(function(Hit)
if Hit.Parent:FindFirstChild("Humanoid") then
script.Parent.Parent.JobUI.ScripterFrame.Visible = true
repeat task.wait() until (Animator.Position - Hit.Parent.HumanoidRootPart.Position).magnitude >= 12
script.Parent.Parent.JobUI.ScripterFrame.Visible = false
end
end)
UIDesigner.Touched:Connect(function(Hit)
if Hit.Parent:FindFirstChild("Humanoid") then
script.Parent.Parent.JobUI.UIDFrame.Visible = true
repeat task.wait() until (Animator.Position - Hit.Parent.HumanoidRootPart.Position).magnitude >= 12
script.Parent.Parent.JobUI.UIDFrame.Visible = false
end
end)