Help with giving a item and taking away currency

when the player presses e he doesn’t get the item and no money gets took off him code:
game.Workspace.Part.ProximityPrompt.Triggered:Connect(function(player)
if player.leaderstats.Cash.Value >= 0.15 then player.leaderstats.Cash.Value = player.leaderstats.Cash.Value - 0.15
local newitem = script.Parent.Parent.CC:Clone()
newitem.Parent = player.Backpack
end

end)

Format code moment

game.Workspace.Part.ProximityPrompt.Triggered:Connect(function(player)
    print("The event has been fired")
    if player.leaderstats.Cash.Value >= 0.15 then 
        print("The player has the desired Cash")
        player.leaderstats.Cash.Value = player.leaderstats.Cash.Value - 0.15
        print("Cloning the item to the player's backpack")
        local newitem = script.Parent.Parent.CC:Clone()
        newitem.Parent = player.Backpack
    end
end)

Could you try this and see what Outputs you get?

2 Likes

im not receiving any outputs odd

Hm, how about this?

local ProxService = game:GetService("ProximityPromptService")

function ItemCheck(player)
    print("The event has been fired")
    if player.leaderstats.Cash.Value >= 0.15 then 
        print("The player has the desired Cash")
        player.leaderstats.Cash.Value = player.leaderstats.Cash.Value - 0.15
        print("Cloning the item to the player's backpack")
        local newitem = script.Parent.Parent.CC:Clone()
        newitem.Parent = player.Backpack
    end
end)

ProxService.PromptTriggered:Connect(ItemCheck)

If that doesn’t work, then you might need to turn on API Services or something?

1 Like

it was working before and api services are on i tested that script and it didnt fire anything.

That’s strange, try restarting Studio perhaps? :thinking:

yeah ill try restarting i have been on it for 4 hours.

still nothing strange. :thinking:

Hm, not to be foolish or anything but you can check if there are any errors or add a breakpoint to where the function is?

see the odd thing is that there is no errors

Are you putting this in a disabled script? Is it a local script?

its ok now i found out the issue there was a useless bit of code at the end that stopedit from functioning