Im trying to make notification system, when a player kills another player, freezes etc… It shows for example “[player] has killed you”
ClientHandler :
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local Players = game:GetService("Players")
local player = Players.LocalPlayer
local TweenService = game:GetService("TweenService")
local playerGui = player:WaitForChild("PlayerGui")
local notifications = playerGui:FindFirstChild("Notifications")
local killTemplate = Instance.new("Frame")
killTemplate.Name = "KillTemplate"
killTemplate.Size = UDim2.new(0.35, 0, 0.08, 0)
killTemplate.Position = UDim2.new(0.5, 0, 1, 0)
killTemplate.AnchorPoint = Vector2.new(0.5, 1)
killTemplate.BackgroundColor3 = Color3.fromRGB(150, 40, 40)
killTemplate.Visible = false
local killLabel = Instance.new("TextLabel")
killLabel.Name = "Message"
killLabel.Size = UDim2.new(1, 0, 1, 0)
killLabel.BackgroundTransparency = 1
killLabel.Text = ""
killLabel.TextColor3 = Color3.new(1, 1, 1)
killLabel.Font = Enum.Font.GothamBold
killLabel.TextSize = 18
killLabel.TextXAlignment = Enum.TextXAlignment.Center
killLabel.Parent = killTemplate
local stroke = Instance.new("UIStroke")
stroke.Thickness = 2
stroke.Parent = killTemplate
local corner = Instance.new("UICorner")
corner.CornerRadius = UDim.new(0, 8)
corner.Parent = killTemplate
killTemplate.Parent = notifications
local freezeTemplate = killTemplate:Clone()
freezeTemplate.Name = "FreezeTemplate"
freezeTemplate.BackgroundColor3 = Color3.fromRGB(40, 40, 150)
freezeTemplate.Parent = notifications
local function showNotification(notificationType, attackerName)
local template = notifications:FindFirstChild(notificationType.."Template")
if not template then return end
local notification = template:Clone()
notification.Name = notificationType.."Notification"
notification.Message.Text = attackerName.." "..notificationType:lower().."ed you!"
notification.Visible = true
notification.Parent = notifications
local tweenIn = TweenService:Create(
notification,
TweenInfo.new(0.3, Enum.EasingStyle.Quad, Enum.EasingDirection.Out),
{Position = UDim2.new(0.5, 0, 0.8, 0)}
)
local tweenOut = TweenService:Create(
notification,
TweenInfo.new(0.3, Enum.EasingStyle.Quad, Enum.EasingDirection.In),
{Position = UDim2.new(0.5, 0, 1, 0)}
)
tweenIn:Play()
task.delay(3, function()
tweenOut:Play()
tweenOut.Completed:Wait()
notification:Destroy()
end)
end
local TrollEvents = ReplicatedStorage:WaitForChild("Remotes"):WaitForChild("Trolls")
TrollEvents.Kill.OnClientEvent:Connect(function(attacker)
showNotification("Kill", attacker.Name)
end)
TrollEvents.Freeze.OnClientEvent:Connect(function(attacker)
showNotification("Freeze", attacker.Name)
end)
And the ServerHandler
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local remotes = ReplicatedStorage:WaitForChild("Remotes")
local trollRemotes = remotes:WaitForChild("Trolls")
local NotifyPlayer = remotes:FindFirstChild("NotifyPlayer")
trollRemotes.Kill.OnServerEvent:Connect(function(plr, target, cost)
if not plr or not target then return end
if plr.leaderstats.Cash.Value >= cost then
plr.leaderstats.Cash.Value -= cost
if target.Character then
target.Character.Humanoid.Health = 0
end
NotifyPlayer:FireClient(target, "Kill", plr.Name)
end
end)
trollRemotes.Freeze.OnServerEvent:Connect(function(plr, target, cost)
if not plr or not target then return end
if plr.leaderstats.Cash.Value >= cost then
plr.leaderstats.Cash.Value -= cost
if target.Character then
local humanoid = target.Character.Humanoid
humanoid.WalkSpeed = 0
humanoid.JumpHeight = 0
NotifyPlayer:FireClient(target, "Freeze", plr.Name)
task.delay(5, function()
if humanoid and humanoid.Parent then
humanoid.WalkSpeed = 16
humanoid.JumpHeight = 7.2
end
end)
end
end
end)
Output doesn’t show any errors, the TextLabel just doesn’t update.