So I've been trying to make killstreaks for my game but every time I try to get the value of creator from the humanoid of the player that dies it comes up with this error:
20:01:55.010 - Workspace.OnDeath:34: bad argument #2 to '?' (string expected, got userdata) 20:01:55.011 - Script 'Workspace.OnDeath', Line 34 20:01:55.012 - Stack End
And this is the part of the script in which the error is happening:
Game.Players.PlayerAdded:connect(function(plr)
plr.CharacterAdded:connect(function(char)
plr:WaitForChild("Data"):WaitForChild("Morph") wait(0)
if plr.TeamColor ~= Game.Teams.Lobby.TeamColor then
Game.Workspace:FindFirstChild(plr.Data.Morph.Value):Invoke(plr.Character)
Game.ServerStorage.Weapons:FindFirstChild(plr.Data.Morph.Value):Clone().Parent = plr.Character
local HealthManager = script.HealthManager:Clone()
HealthManager.Parent = plr.Character:FindFirstChild("Humanoid")
HealthManager.Disabled = false
local Killstreak = Instance.new("IntValue", plr.Character)
Killstreak.Name = "Killstreak"
print(plr.Character:FindFirstChild("Killstreak"))
plr.Character.Humanoid.Died:connect(function()
print("Person died")
if plr.Character.Humanoid:FindFirstChild("creator") then
creat = plr.Character.Humanoid:FindFirstChild("creator")
local killer = game.Players[creat.Value]
print(killer)

5 comments
Use Lua Text Box.
Oh, sorry about that.
Hmm.. Can you post the whole script, not to bother you.
I'll only put the parts that relate to the question.
Mk.