Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
-1

Why isnt this working?

Asked by 10 years ago

Please make your question title relevant to your question content. It should be a one-sentence summary in question form.
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

Log in to vote
0
Answered by
Perci1 4988 Trusted Moderation Voter Community Moderator
10 years ago

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.

Ad

Answer this question