Hello, I have added a proximity prompt to a part and when used, it sells the item you currently have. I made this by creating a "Tools" folder in the proximityprompt, followed by a Boolvalue (Name of tool) and Numbervalue (Price of tool)
So the structure looks like this:
Part - Proximityprompt -- Tools (Folder) --- Sword (Boolvalue) ---- Price (Numbervalue)
Now I have been stuck with on prohibitng from selling certain items. Lets say we have a tool named "Sword1", and I want that everything can be sold except for this "Sword1", how should I do that? I have tried with "if..." scripts but I cannot figure out what I am doing wrong.
Below you can find the script.
local prox = script.Parent prox.Triggered:Connect(function(player) for i, tools in pairs(prox.Tools:GetChildren()) do if player.Character:FindFirstChild(tools.Name) then player.leaderstats.Cash.Value += tools.Price.Value player.Character:FindFirstChild(tools.Name):Destroy() end end end)
local prox = script.Parent prox.Triggered:Connect(function(player) for i, tools in pairs(prox.Tools:GetChildren()) do if player.Character:FindFirstChild(tools.Name) and tools.Name ~= "Sword1" then player.leaderstats.Cash.Value += tools.Price.Value player.Character:FindFirstChild(tools.Name):Destroy() end end end)
i think this is the answer if (and tools.Name ~= "Sword1") dosent work then try (and not tools.Name == "Sword1")