A localscript function triggering all players instead of one

Hello, I’m writing a code in which if the player stands on a certain block, he gets a notification with yes / no options and then depending on the answer, there’s a different function running. However, the actual send notification function seems to be sending the yes/no notification across every player in the game, rather than the one who stepped on the block.
Can’t wait for the feedback

local function callback1(Text)
	if Text == "Yes" then
		game.ReplicatedStorage.RemoteEventsStorage.teleportUser:FireServer(script.TeleportDestination.Value)
	end
end

NotificationBindableTeleport.OnInvoke = callback1

for i, child in ipairs(teleportTriggers) do
	child.Touched:connect(function(player)
		if debounce == false then
			debounce = true
			game:GetService("StarterGui"):SetCore("SendNotification",{
				
				Title = child.Name;
				Text = "Do you want to enter?";
				Duration = 5;
				Button1 = "Yes";
				Button2 = "No";
				Callback = NotificationBindableTeleport;
			})
			script.TeleportDestination.Value = child.Name
			wait(5)
			debounce = false
		end
		
	end)
	
	
end

Touched fires when a part is touched, it doesn’t only fire when the local player touches it.

So you’ll want something like

local Players = game:GetService("Players")

local client = Players.LocalPlayer

-- ...

child.Touched:Connect(function(part)
    if not part:IsDescendantOf(client.Character) then
        return
    end
    
    -- ...
end)

Just an example

1 Like

thank you very much, really appreciated.