Union.Touched - Gui

game.Workspace.Bankomat.Union.Touched:Connect(function(player)
	RedeemFrame.Visible = true
	localPlayer.Character:FindFirstChildOfClass("Humanoid"):UnequipTools()
	game:GetService("StarterGui"):SetCoreGuiEnabled(Enum.CoreGuiType.Backpack, false)
end)

image

Hello! I need help. If player touching part all player see this gui. I need the gui be seen only by him

I had that problem before too, you need to use magnitude like:

local Magnitude = (player.Character.HumanoidRootPart.Position - part.Position).Magnitude
If Magnitude < 5 then
Gui.Enabled = true
else
Gui.Enabled = false
end

And add this lines of code inside a loop or runservice to check if the player is near the part you want the gui to apear.
If you have any more problems with this please consider replying to me back!

1 Like

When any player touches this, all the players will see it because there is no check what player it is. You also don’t check if the hit is an actual player!

local plr = game.Players.LocalPlayer

game.Workspace.Bankomat.Union.Touched:Connect(function(hit)
    local hitPlr = game.Players:GetPlayerFromCharacter(hit.Parent)
    if (hitPlr == nil) then return end
    if (hitPlr ~= plr) then return end

    RedeemFrame.Visible = true
    plr.Character:FindFirstChildOfClass("Humanoid"):UnequipTools()
	game:GetService("StarterGui"):SetCoreGuiEnabled(Enum.CoreGuiType.Backpack, false)
end)
2 Likes