Im making so the backpack gui hides when a players touchs a part. But im trying to make it so only the player who is touching the part that there backpack is hidden.
Its in a local Script
local char = game.Players.LocalPlayer.Character or game.Players.LocalPlayer.CharacterAdded:Wait()
local human = char:FindFirstChild("Humanoid")
game.StarterGui:SetCoreGuiEnabled(
Enum.CoreGuiType.Backpack, false
)
game.Workspace.NoSir.Touched:Connect(function(player)
if player and player.Parent and player.Parent:FindFirstChild("Humanoid") then
game.StarterGui:SetCoreGuiEnabled(
Enum.CoreGuiType.Backpack, false
)
else
return
end
end)
game.Workspace.NoSir.TouchEnded:Connect(function(player)
if player and player.Parent and player.Parent:FindFirstChild("Humanoid") then
game.StarterGui:SetCoreGuiEnabled(
Enum.CoreGuiType.Backpack, true
)
end
end)
It runs fine but it makes it so if one player touches the part then everyones backpack gui is hidden. All I want is only the player who is touching the part there backpack gui is hidden
no mate sorry it was a typo i dont believe you can control the core backpack for one player as far as i know. best to use a customer backpack control it in a local script.
you dont check if the localplayer is touching the part so it disables for all players when touched by a character
part.Touched:Connect(function(hit)
local Player = game.Players:GetPlayerFromCharacter(hit.Parent)
if Player and Player == LocalPlayer then
print("localpalyer touched the part")
end
end)