Hello. This should be a script to purchase a particular item through ProximityPrompt. The problem arises when I have to add a "player" variable to the path to take a certain amount of money from the player. It needs to work in "Script", not "LocalScript", so I need something like *".LocalPlayer" *mode for "Script". I hope you understand the problem.
Error:
Workspace.ropebuy.Script:10: invalid argument #2 (string expected, got Instance). Error mark firsts "if" line as a problem.
Thanks.
local price = 200
script.Parent.item.ProximityPrompt.Triggered:Connect(function(player)
if game.Players[player].Backpack.Money.Value >= price then
game.Players[player].Backpack.Money.Value = game.Players[player].Backpack.Money.Value - price
print("Buyed")
end
if game.Players[player].Backpack.Money.Value < price then
script.Parent.error:Play()
print("No money")
end
end)

3 comments
For line 10 and the rest, I'm pretty sure you have to do game.Players[player.Name]
correct me if I'm wrong though
@echobloxia Thanks, that is a problem. : )