I’m trying to make it so the script takes away your item, and then gives you money in return.
The script does absolutely nothing, doesn’t even print when I put a print statement outside of the function, there are no errors either.
The script is a clone under a proximity prompt which is put into a part in workspace.
script.Parent.Triggered:Connect(function(player)
local Item = script.Parent.Value.Value
print(Item)
if player.Backpack:FindFirstChild(Item) then
player:WaitForChild("leaderstats")
player.Backpack[Item]:Destroy()
player.leaderstats.Money.Value += math.random(50,80)
elseif player.Character:FindFirstChild(Item) then
player:WaitForChild("leaderstats")
player.Character[Item]:Destroy()
player.leaderstats.Money.Value += math.random(50,80)
else
print("you dont have the item")
end
end)
Here’s a snippet from the other script that’s supposed to enable it n stuff.
local prompt = script.Parent.Parent.DeliverPrompt:Clone()
prompt.Parent = game.Workspace.Towns[city][num]
prompt.Value.Value = script.Parent.Item.Text
prompt.Script.Enabled = true
By the way a lot of my scripts could probably be written WAY better but I only started scripting like a few months ago, sorry.