I need to figure out a way to award money to the player who kills one of the aliens in my game, I want to be able to award 25 for each kill, but I want ti to go the that one player, does anyone have any idea? If you have a place where I could go to, that would be great, if anyone could explain to me the basics of how I would do this, that would be greatly appreciated.
This depends on how the weapons are scripted, but in most weapons, there is code to add a 'creator' tag to the Humanoid
that the weapon is damaging. So to detect who killed what alien, you'd probably have something like this.
local Players = Game:GetService("Players") function AlienKilled(alien, killer) print(killer.Name .. " killed an alien.") -- award points to `killer` end function AlienDied(alien) local tag = alien:FindFirstChild("Humanoid"):FindFirstChild("creator") if tag and tag.Value then AlienKilled(alien, tag.Value) end end function AlienSpawned(alien) alien:WaitForChild("Humanoid").Died:connect(function() AlienDied(alien) end) end Workspace.ChildAdded:connect(function(child) if child:IsA("Model") and child.Name:lower() == "alien" then AlienSpawned(child) end end)