Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -- Sells all items and gives gold
- local sellPart = script.Parent
- local function sellItems(playerItems, playerGold)
- local totalSell = playerItems.Value * 100
- playerGold.Value = playerGold.Value + totalSell
- playerItems.Value = 0
- end
- local function onTouch(partTouched)
- local character = partTouched.Parent
- local humanoid = character:FindFirstChildWhichIsA("Humanoid")
- if humanoid then
- local player = game.Players:GetPlayerFromCharacter(humanoid.Parent)
- local playerStats = player:FindFirstChild("leaderstats")
- --Get the player's items + money
- local playerItems = playerStats:FindFirstChild("Items")
- local playerGold = playerStats:FindFirstChild("Gold")
- print("A player has entered")
- sellItems(playerItems, playerGold)
- end
- end
- sellPart.Touched:Connect(onTouch)
Add Comment
Please, Sign In to add comment