Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

How do I get the player who killed the humanoid from PwntX_X()?

I am making a script and I need the players name who killed it player.name dosen't work I think

moneyamount = 1
local Humanoid = script.Parent.Humanoid 
function PwntX_X() 
local tag = Humanoid:findFirstChild("creator") 
	if tag ~= nil then 
		if tag.Value ~= nil then 
local Leaderstats = tag.Value:findFirstChild("leaderstats") 
			if Leaderstats ~= nil then 
Leaderstats.Cash.Value =Leaderstats.Cash.Value + 2 * game.Players.-- I need the players name here --.Dinosaur2.value 
game.Players-- I need the players name here as well--..Dinosaur2 = game.players--Name again-- .Dinosaur 2.Value

wait(0.1)
    local original = script
    local copy = original:Clone()
    copy.Parent = original.Parent
			end 
		end 
	end 
end 
Humanoid.Died:connect(PwntX_X) 

Some of them are not Capital letters when they are supposed to be. Please answer please!! please dont copy the script!

6 comments

0

Instance:findFirstChild and RBXScriptSignal:connect are deprecated, use ServiceProvider:GetService to get all services except Workspace.

0

you can use square brackets with a string inside them to see if something is a child of something else

0

like : if workspace["y"] then

0

I would also like to point out that you can use the collection service for tags instead of creating object values

0

thankyou but can you answer the question

0

every player has the dinosaur 2 value

1 answer

I know the answer! you have to make another leaderstat instead of using a value in the player and then do what you need

This discussion is preserved as it was. New answers, comments, and votes are closed.