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

Why isnt this working?

local person = game.Players:playerFromCharacter()

if people.leaderstats.Stage.Value == 45	then			
	newchatline = Instance.new("TextLabel",v:WaitForChild("PlayerGui").Chat.Frame)
	newchatline.Text = "[WINNER] " ..player.Name.. ": " ..msg
	newchatline.Size = UDim2.new(1,0,0,20)
	newchatline.Position = UDim2.new(0,0,1,-15)
	newchatline.Font = "ArialBold"
	newchatline.TextStrokeTransparency = 0
	newchatline.BackgroundTransparency = 1
	newchatline.BorderSizePixel = 0
	newchatline.FontSize = "Size18"
	newchatline.TextXAlignment = "Left"
	newchatline.TextYAlignment = "Top"
	newchatline.ClipsDescendants = true
	newchatline.Name = "line1"				
	newchatline.TextColor3 = Color3.new(85/255, 1, 0)
end

This whole things, I am just asking, am I doing it right. I want to ask if the person variable and if the if statement checks if their leaderboard value == 45

1 answer

✓ Accepted answer

First, playerFromCharacter() is deprecated. Use GetPlayerFromCharacter() instead.

Second, you don't supply the argument for that method. GetPlayerFromCharacter() attempts to get the player from a character, but how can it do that if you don't give it a character? You just leave the parentheses blank. You have to supply the character argument, and then it will attempt to get the player from that character.

Third, 'people' is defined nowhere. It's a nil value.

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