So basically I have a zombie npc and every time you kill the zombie it should give the last player that damaged it a reward, the problem is it's not doing this and I really don't have a solution. Maybe one of you guys can figure it out?
rewardmessage = game.Lighting.KillerReward
script.Parent.Zombie.Died:connect(function()
if script.Parent.Zombie.Health == 0 then
local killer = script.Parent.Zombie.creator
print(killer.Value)
local rewardclone = rewardmessage:clone()
rewardclone.Parent = game.Players[killer.Value].PlayerGui.MainScreen
if game.Players[killer.Value].PlayerGui.MainScreen.PlayerValues.HasCoinBooster.Value == true then
rewardclone.CoinReward.Text = "+2 coins"
if game.Players[killer.Value].PlayerGui.MainScreen.PlayerValues.HasXPBooster.Value == true then
rewardclone.XPReward.Text = "+10 XP"
else rewardclone.XPReward.Text = "+5 XP"
end
else
rewardclone.CoinReward.Text = "+1 coin"
if game.Players[killer.Value].PlayerGui.MainScreen.PlayerValues.HasXPBooster.Value == true then
rewardclone.XPReward.Text = "+10 XP"
else
rewardclone.XPReward.Text = "+5 XP"
end
end
end
end)

2 comments
If you figured it out, feel free to post an answer explaining what you had to do. It could help other people who have similar issues, or who just can't figure out what's wrong here.
Okay