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

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

Asked by 3 years ago

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)
0
Quick question, what is "creator"? Is it like a value or what? KixWater 126 — 3y
0
Are you wanting it to print your name only? PatrykWalat 4 — 3y
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 StylistStuidiozGey 0 — 3y

1 answer

Log in to vote
0
Answered by 3 years ago

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
0
i want to print my player's name that's inside the "Players" service using playerName (creator.Value). Hope you could understand that StylistStuidiozGey 0 — 3y
Ad

Answer this question