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 4 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

01script.Parent.Changed:Connect(function()
02    --script.Parent is humanoid
03    if script.Parent.Health == 0 then
04        if script.Parent:FindFirstChild("creator") then
05            local creator = script.Parent.creator
06            local playerName = creator.Value
07            print(game.Players:FindFirstChild(playerName))
08        end
09    end
10end)
0
Quick question, what is "creator"? Is it like a value or what? KixWater 126 — 4y
0
Are you wanting it to print your name only? PatrykWalat 4 — 4y
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 — 4y

1 answer

Log in to vote
0
Answered by 4 years ago

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

1creator.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 — 4y
Ad

Answer this question