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

CAN YOU BE THE CHOSEN ONE TO SOLVE THIS MYSTERY...?

this script is inside a character model's humanoid and it detects if the humanoid finds a creator whenever the humanoids health goes to 0.

In line 7, it prints nil instead of printing playerName even though I can clearly see my name inside the Player service

script.Parent.Changed:Connect(function()
	--script.Parent is humanoid
	if script.Parent.Health == 0 then
		if script.Parent:FindFirstChild("creator") then
			local creator = script.Parent.creator
			local playerName = creator.Value
			print(game.Players:FindFirstChild(playerName))
		end
	end
end)

3 comments

0

Quick question, what is "creator"? Is it like a value or what?

0

Are you wanting it to print your name only?

0

creator is a stringvalue all swords/weapons use to detect who killed you using the creator's value be the player's name. I want it to print out a certain player's name in the "Players" service using playerName, which is the creator's value; which is my name

1 answer

I'm assuming you want to change the creator value to the player's name? In that case change line 6 to

creator.Value = playerName

1 comment

0

i want to print my player's name that's inside the "Players" service using playerName (creator.Value). Hope you could understand that

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