So, whenever I kill anyone, my name appears on my screen and their name appears on their screen. The problem is, I haven’t died in the game but my name still appears.
Here’s the 2 scripts:
Server-Sided Script:
local TweenService = game:GetService("TweenService")
local tweenInfo = TweenInfo.new(3)
local tableOfPhrases = {" got fried!", " got dundendun did brodda"," watched an among us animation video", " literally exploded"}
local remote = game:GetService("ReplicatedStorage"):WaitForChild("DeathAnnounceEvent")
game:GetService("Players").PlayerAdded:Connect(function(Player)
local DeathT = Player.PlayerGui:WaitForChild("DeathAnnounce").Death
local tween = TweenService:Create(DeathT,tweenInfo,{["BackgroundTransparency"] = 0, ["TextTransparency"] = 0})
local tween2 = TweenService:Create(DeathT,tweenInfo,{["BackgroundTransparency"] = 1, ["TextTransparency"] = 1})
Player.CharacterAdded:Connect(function(Character)
Character:WaitForChild("Humanoid").Died:Connect(function()
remote:FireAllClients()
if Character:WaitForChild("Humanoid").Health >=1 then
return
end
end)
end)
end)
Client-sided Script:
local remote = game:GetService("ReplicatedStorage"):WaitForChild('DeathAnnounceEvent')
local Player = game.Players.LocalPlayer or game.Players.PlayerAdded:Wait()
local tweenInfo = TweenInfo.new(3)
local char = Player.Character or Player.CharacterAdded:Wait()
local TweenService = game:GetService("TweenService")
local DeathT = Player.PlayerGui:WaitForChild("DeathAnnounce").Death
local tween = TweenService:Create(DeathT,tweenInfo,{["BackgroundTransparency"] = 0, ["TextTransparency"] = 0})
local tween2 = TweenService:Create(DeathT,tweenInfo,{["BackgroundTransparency"] = 1, ["TextTransparency"] = 1})
local tableOfPhrases = {" got fried!", " got dundendun did brodda"," watched an among us animation video", " literally exploded"}
remote.OnClientEvent:Connect(function()
tween:Play()
local randNumber = math.random(1,#tableOfPhrases)
DeathT.Text = Player.Name .. tableOfPhrases[randNumber]
task.wait(2.5)
tween2:Play()
print("@" .. Player.DisplayName .. " has fallen!")
end)
Any help is appreciated! Have a nice day/night.