I don't know how to find the name of the player to go in his leaderstats value because I have to find the player to take money from him when he passes on a plate here is my script :
owner = script.Parent.Parent.Parent.Parent.Owner
owned = script.Parent.Parent.Parent.Parent.Owned
drop = script.Parent
droppeur = script.Parent.Parent.Boddy.Transparency
part = script.Parent.Parent.drop.Transparency
nameplayer = script.Parent.Parent.Parent.Parent.NamePlayer.Name
script.Parent.Parent.Boddy.Transparency = 1
script.Parent.Parent.drop.Transparency = 1
function dropper()
local part = Instance.new("Part", game.Workspace)
-- part.Parent = game.Workspace
part.Name = "Ressource"
part.Position = drop.Position
part.Size = Vector3.new(1, 1, 1)
local valeur = Instance.new("IntValue")
valeur.Parent = part
valeur.Name = "Valeur"
valeur.Value = 5
end
script.Parent.Parent.Parent.Parent.Buttons["Purchase a dropper MK2 - 15$"].Head.Touched:Connect(function(hit)
if owned.Value == true then
if owner.Value == hit.Parent.Name then
if game.Players:FindFirstChild('nameplayer'):FindFirstChild("leaderstats").Cash.Value >= 15 then
while true do
dropper()
wait(2)
end
end
end
end
end)
