local SS = game.ServerStorage
local weapon = SS["Desert Eagle"]

script.Parent.MouseButton1Down:Connect(function(Player)
	if Player:WaitForChild("cash") then
		print("cash exists")
		if Player.cash.Cash.Value >= 25 then
			print("cash is equal or over 25")
			Player.cash.Cash.Value = Player.cash.Cash.Value - 25
			print("cash should have decreased")
		end
	end
end)

It does absolutely nothing. Why? (I know i didn't give the player the deagle. I wasn't at that step yet. I just want my money to decrease first.)

3 comments

0

Prints don't show up either/

0

Your gui script is using ServerStorage, that's an issue I spot right away. Use a local script instead of a server script. Local scripts only affect the client, so you want to use this GUIs that only the player can interact with. Secondly, local scripts CANNOT access ServerStorage because local scripts only affect the client, it cannot interact with the server without remote events or functions.

0

TL;DR: Use a local script instead. Use a remote event to clone the weapon into the player's backpack and use a remote event to also change the cash value, as both of those are part of the server (I assume).