So I am trying to make a simulator game and I don't understand how :GetPlayerFromCharacter works. I read https://developer.roblox.com/en-us/api-reference/function/Players/GetPlayerFromCharacter but I still don't understand. Can anyone explain what it does with low scripting vocabulary. Thank You
local function Sell(player)
local blocks = player:WaitForChild("leaderstats"):WaitForChild("blocks")
local coins = player:WaitForChild("leaderstats"):WaitForChild("coins")
local add = blocks.Value * multiplier
coins.Value = coins.Value + add
blocks.Value = 0
end
local function touched(Part)
if game.Players:GetPlayerFromCharacter(Part.Parent) then
Sell(game.Players:GetPlayerFromCharacter(Part.Parent))
end
end
script.Parent.Touched:Connect(touched)
