I have a script that rewards a player for killing a zombie but I'm having some issues with it, maybe one of you guys can help me fix the problem? Whenever the user kills a zombie this error outputs: Workspace.map1.Zombie.Reward:10: bad argument #2 to '?' (string expected, got userdata)
rewardmessage is a gui found in lighting everything else should be understandable oh also this script in found inside a zombie (npc, whatever you want to call it) (The script also is not fully completed, the main functional parts are coded but don't seem to be working) Script:
rewardednowdie = false
rewardmessage = game.Lighting.KillerReward
repeat
wait()
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
rewardednowdie = true
end
until rewardednowdie == true

1 comment
Thanks for pointing this out but this still does not solve my problem..