Notification shows to All Players, how to fix?

I edited somehow this Notification Script that i got on this formu and its works fine but its shows to every player,but I want that the notifiaction is only showing to the player that has killed a mob

i tried to put the script in a local script but its still not work.

Here is my Script

UI = script.Parent
MaxNotifications = 5
NotificationDuration = 5

function createNotification(NotificationText)
	local Notifications = UI.Notifications:GetChildren()
	if #Notifications >= MaxNotifications then
		Notifications[1]:TweenPosition(UDim2.new(1.5, 0, Notifications[1].Position.Y.Scale, 0),"InOut","Linear",0.2,true);wait(0.2)
		Notifications[1]:Destroy()
		for i,v in pairs(Notifications) do if v ~= nil then
			v:TweenPosition(UDim2.new(0.97, 0, v.Position.Y.Scale - 0.12, 0),"InOut","Linear",0.2,true)
			end
		end
		local NewNotification = UI.NotificationTemplate:Clone()
		NewNotification.Name = tostring(#Notifications+1)
		NewNotification.Parent = UI.Notifications
		NewNotification.Text.Text = NotificationText
		NewNotification:TweenPosition(UDim2.new(0.97, 0, 0.85, 0),"InOut","Linear",0.2,true)
	else
		for i,v in pairs(Notifications) do
			v:TweenPosition(UDim2.new(0.97, 0, v.Position.Y.Scale - 0.12, 0),"InOut","Linear",0.2,true)
		end
		local NewNotification = UI.NotificationTemplate:Clone()
		NewNotification.Name = tostring(#Notifications+1)
		NewNotification.Parent = UI.Notifications
		NewNotification.Text.Text = NotificationText
		NewNotification:TweenPosition(UDim2.new(0.97, 0, 0.85, 0),"InOut","Linear",0.2,true)
		delay(NotificationDuration,function()
			NewNotification:TweenPosition(UDim2.new(1.5, 0, NewNotification.Position.Y.Scale, 0),"InOut","Linear",0.2,true);wait(0.2)
			NewNotification:Destroy()
		end)
	end
end

local Enemy = game.Workspace.MobHolder.Bosses.ZombieBoss.Enemy
local _M = require(game.Workspace.MobHolder.Bosses.ZombieBoss.MobConfig)




Enemy.Died:Connect(function()
	createNotification("+".._M.GoldAward.."$ for killing a Zombie Boss!")
	createNotification("+".._M.ETAward.." Tocken for killing a Zombie Boss!")
end)


---------------------------------------------------------------
local Zombies = game.Workspace.MobHolder.Zombies:GetChildren()

local CashZombie = require(game.Workspace.MobHolder.Zombies.Zombie.MobConfig)

for i,v in ipairs(Zombies) do
	
	
v.Enemy.Died:Connect(function()
		createNotification("+"..CashZombie.GoldAward.."$ for killing a Zombie!")
		createNotification("+"..CashZombie.ETAward.." Tocken for killing a Zombie!")
end)
	
end

I would be very Happy about a fast Answer :slight_smile:

You have to actually have a method in place for checking the killer of the enemy, your connection to the enemy’s Died signal does not specify who had to kill the enemy, just that the enemy had to die.

1 Like

if i do the check who killed the enemy , would the notification only show to the killer?