local tiger = script.Parent
local humanoid = tiger:WaitForChild("Humanoid")
local debounce = true
local attackAnim = humanoid:LoadAnimation(script.Attack)
game.ReplicatedStorage.Attack.OnServerEvent:Connect(function()
print(0)
for i,player in pairs(game.Players:GetPlayers()) do
print(1)
local target = player.Character
local distance = (tiger.HumanoidRootPart.Position - target.HumanoidRootPart.Position).Magnitude
if distance <= 8 and target and target ~= tiger and humanoid.WalkSpeed ~= 0 and debounce == true and target.Name ~= "Tiger" and target.Name ~= "Tiger1" then
debounce = false
print(2)
tiger.Head.AttackSound:Play()
local playerDeath = game.ReplicatedStorage:WaitForChild("playerdeath")
local KillFeed = game.ReplicatedStorage:WaitForChild("KillFeed")
local player = game.Players:GetPlayerFromCharacter(target)
local tigerplayer = game.Players:GetPlayerFromCharacter(tiger)
playerDeath:FireClient(player,tiger)
attackAnim:Play()
attackAnim.Stopped:Wait()
target.Humanoid.Health = 0
tigerplayer.leaderstats.Meat.Value += 1
KillFeed:FireClient(tigerplayer,player)
wait(10)
debounce = true
end
end
end)
Local Script:
game.ReplicatedStorage.KillFeed.OnClientEvent:Connect(function(tigerplayer,player)
local thumb1 = Enum.ThumbnailType.HeadShot
local thumb2 = Enum.ThumbnailSize.Size420x420
script.Parent.Visible = true
script.Parent.PlayerName.Text = player.Name
script.Parent.PlayerImage.Image = game:GetService("Players"):GetUserThumbnailAsync(player.UserId,thumb1,thumb2)
end)
Error:
Players.Player2.PlayerGui.KillFeed.Frame.LocalScript:5: attempt to index nil with 'Name'
When firing a RemoteEvent to the client on the server you’ve to pass the actual Player argument first that the RemoteEvent would land on, you’re currently actually passing one argument not two.
Example:
-- Server
local Player = -- The player who you're going to fire a remote event to.
local OtherPlaer = -- any other argument
RemoteEvent:FireClient(Player, OtherPlayer)
-- Client
local Player = game.Players.LocalPlayer
RemoteEvent.OnServerEvent:Connect(function(OtherPlayer)
end)
local tiger = script.Parent
local humanoid = tiger:WaitForChild("Humanoid")
local debounce = true
local attackAnim = humanoid:LoadAnimation(script.Attack)
game.ReplicatedStorage.Attack.OnServerEvent:Connect(function()
print(0)
for i,player in pairs(game.Players:GetPlayers()) do
print(1)
local target = player.Character
local distance = (tiger.HumanoidRootPart.Position - target.HumanoidRootPart.Position).Magnitude
if distance <= 8 and target and target ~= tiger and humanoid.WalkSpeed ~= 0 and debounce == true and target.Name ~= "Tiger" and target.Name ~= "Tiger1" then
debounce = false
print(2)
tiger.Head.AttackSound:Play()
local playerDeath = game.ReplicatedStorage:WaitForChild("playerdeath")
local KillFeed = game.ReplicatedStorage:WaitForChild("KillFeed")
local player = game.Players:GetPlayerFromCharacter(target)
local tigerplayer = game.Players:GetPlayerFromCharacter(tiger)
playerDeath:FireClient(player,tiger)
attackAnim:Play()
attackAnim.Stopped:Wait()
target.Humanoid.Health = 0
tigerplayer.leaderstats.Meat.Value += 1
KillFeed:FireClient(tigerplayer,player)
wait(10)
debounce = true
end
end
end)
LocalScript
game.ReplicatedStorage.KillFeed.OnClientEvent:Connect(function(player)
local thumb1 = Enum.ThumbnailType.HeadShot
local thumb2 = Enum.ThumbnailSize.Size420x420
script.Parent.Visible = true
script.Parent.PlayerName.Text = player.Name
script.Parent.PlayerImage.Image = game:GetService("Players"):GetUserThumbnailAsync(player.UserId,thumb1,thumb2)
end)