Hello I would like to find the name of the person who passes over a block to be able to access its variables and to change it because my game is a tycoon and as in all tycoons there are buttons on the ground to buy any item but I can't get into its variables to decrease his money to pay for the item, I hope you understood. Here is my script:
owner = script.Parent.Parent.Parent.Parent.Owner
owned = script.Parent.Parent.Parent.Parent.Owned
nameplayer = script.Parent.Parent.Parent.Parent.NamePlayer
boddy = script.Parent.Parent.Parent.Parent.Starter.Dropper2.Boddy
part = script.Parent.Parent.Parent.Parent.Starter.Dropper2.drop
script.Parent.Touched:Connect(function(hit)
if owned.Value == true then
if owner.Value == hit.Parent.Name then
nameplayer.Name = hit.Parent.Name
if game.Players:FindFirstChild('nameplayer'):FindFirstChild("leaderstats").Cash.Value >= 15 then
boddy.Transparency = 0
part.Transparency = 0.5
game.Players:FindFirstChild('nameplayer'):FindFirstChild("leaderstats").Cash.Value = game.Players:FindFirstChild('hit.Parent.Name'):FindFirstChild("leaderstats").Cash.Value - 15
script.Parent:Destroy()
end
end
end
end)
