local shirtid = script:FindFirstChild("Shirt")
local pantsid = script:FindFirstChild("Pants")
script.Parent.Parent.ProximityPrompt.Triggered:Connect(function(plr)
plr.leaderstats.Money.Value -= 50
plr.Character.Shirt.ShirtTemplate = shirtid.ShirtTemplate
plr.Character.Pants.PantsTemplate = pantsid.PantsTemplate
end)
Also, I noticed you put += -50, that could work. But if you want to subtract, why not just use -=?
[If you didnt know, hope you’ll use this from now on this way, since it’s more efficient]
Also, it’s possible that the player doesnt have a shirt/pants on himself. Thus, you’ll need to check for that, and when it happens, create a shirt and/or a pants for him with the ID’s you stored above.
This clip doesnt really help much, I understand the issue,
But I need to see relevant screenshots from studio[ show us where that part is located and the script + those clothes location aswell], that might help us.
local ShirtID = 244124412 -- Enter it here
local PantsID = 345325322 -- Enter it here
local Price = 50
[path.to.proximityPrompt].Triggered:Connect(function(player)
--// Data
local Money = player.leaderstats.Money
if Money.Value >= 50 then
Money.Value -= Price
else
warn(player.Name.." does not have enough money! Need: "..(Price - Money.Value))
end
--// Character
local Character = player.Character or player.CharacterAdded:Wait()
Character:FindFirstChildWhichIsA("Shirt").ShirtTemplate = "rbxassetid://"..ShirtID
Character:FindFirstChildWhichIsA("Pants").PantsTemplate = "rbxassetid://"..PantsID
end)
This should work also make sure to commit your scripts since the error doesn’t add up to the code.