ISUUE: What I am trying to achieve is that when the Player
would Touch a specific Part
then the Backpack
, CoreGui
will disable. However, if the Player
would Touch another Part
then the Backpack
, CoreGui
will be enabled.
Script > StarterGui
local Player = game:WaitForChild("Players").LocalPlayer
local StarterGui = game:GetService("StarterGui")
local ReplicatedStorage = game:GetService("ReplicatedStorage"):WaitForChild("Handler (RS)"):WaitForChild("Events"):WaitForChild("VentEvent")
local Hide = ReplicatedStorage:WaitForChild("Hide")
local Postitions = game:GetService("Workspace"):WaitForChild("Vent"):WaitForChild("Postitions")
local InPos = Postitions:WaitForChild("InPos")
local OutPos = Postitions:WaitForChild("OutPos")
InPos.Touched:Connect(function(Touch)
if Touch.Parent.Name == Player.Name then
StarterGui:SetCoreGuiEnabled(Enum.CoreGuiType.Backpack, false)
print("Touched ".. InPos.Name)
end
end)
OutPos.Touched:Connect(function(Touch)
if Touch.Parent.Name == Player.Name then
StarterGui:SetCoreGuiEnabled(Enum.CoreGuiType.Backpack, true)
print("Touched ".. OutPos.Name)
end
end)