Currency Script Not Working

I am making a jump ability that costs 30K Panies(Currency Name), But It’s not quite working.
I had to use events when the player buys it then the server will check if he has the amount then it will give him the item.
Script:

local RS = game:GetService("ReplicatedStorage")
local JPU = RS.JUMPPU
local MainGui = game.StarterGui.Shop.MainGui
local JumpPower = MainGui.JumpPu

JPU.OnServerEvent:Connect(function(player)
	if player:WaitForChild("leaderstats").Panies.Value == 30000 then
		print("Purchase Made")
		local char = player.Character
		local Human = char:WaitForChild("Humanoid")
		Human.UseJumpPower = true
		wait(1)
		Human.JumpPower = 100
		player:WaitForChild("leaderstats").Panies.Value -= 30000
	end
end)

It Doesn’t Print "Purchase Made"
LocalScript:

local RS = game:GetService("ReplicatedStorage")
local JPU = RS.JUMPPU

local player = game.Players.LocalPlayer

player.PlayerGui.Shop.MainGui.JumpPu.MouseButton1Up:Connect(function()
	JPU:FireServer()
	print("Fired")
end)

It Prints "Fired"

1 Like

From what I remember, instead of using player.PlayerGui.Shop.MainGui.JumpPu.MouseButton1Up:Connect(function() use player.PlayerGui.Shop.MainGui.JumpPu.MouseButton1Click:Connect(function() (if JumpPu is a button)
Second thing is that here Panies.Value == 30000 you check for the exact value, if it costs 30000 then use this Panies.Value >= 30000 which means if the value is equal to or higher than 30000.

3 Likes

Mate, Thank you so much I totally forgot about that lol

1 Like