My money give system dosent work

You can write your topic however you want, but you need to answer these questions:

  1. What do you want to achieve? Keep it simple and clear!
    i want that i can give my in game currency to some one else

  2. What is the issue? Include screenshots / videos if possible!
    a parameter shuffel happens

  3. What solutions have you tried so far? Did you look for solutions on the Developer Hub?
    i dont know , no

After that, you should include more details if you have any. Try to make your topic as descriptive as possible, so that it’s easier for people to help you!

-- script
function MakeGift(CurrencyGiven,playerFrom,playerToName)
	print(CurrencyGiven)
	local module = require(game.ReplicatedStorage.MoneyGive.MoneyGiveModuleScript)
	local chat = game.ReplicatedStorage.moreRemoteEvents.chatWith
	local s,e = pcall(function()
		local num = tonumber(CurrencyGiven)
		local ee = CurrencyGiven + 15
	end)
	if not s then
		return Enum.ProductPurchaseDecision.NotProcessedYet,'CurrencyGiven is not an number'
	end
	--gift
	local gift = Instance.new("Folder")
	--str
	local str = Instance.new("StringValue")
	str.Value = 'From:'..playerFrom.Name
	str.Name = 'From'
	str.Parent = gift
	-- int
	local int = Instance.new("IntValue")
	int.Value =  tonumber(CurrencyGiven) * module.PlayerEarns()
	int.Name = 'Currency'
	--gift
	local playerTo = game.Players:FindFirstChild(playerToName)
	if playerTo then
		gift.Name = playerTo.Name
		gift.Parent = workspace.CashRegisters.CashRegisterPlayerMoney.Payments
		return Enum.ProductPurchaseDecision.PurchaseGranted , 'Enum.ProductPurchaseDecision.PurchaseGranted'
	else
		gift:Destroy()
		return Enum.ProductPurchaseDecision.NotProcessedYet, 'player not found'
	end
	
    
end
game.ReplicatedStorage.MoneyGive.SentGift.OnServerInvoke = MakeGift
-- local script
local close = script.Parent.Parent.Parent.Close
local module = require(game.ReplicatedStorage.MoneyGive.MoneyGiveModuleScript)
Function = function()
	script.Parent.PlayerEarns.Text = module.CalculatePlayerEarns(script.Parent.YourSent.Text)
	script.Parent.PlayerEarnsSeen.Text = module.PlayerEarns()
end

game.ReplicatedStorage.MoneyGive.OpenGui.OnClientEvent:Connect(function()
	local run = game:GetService("RunService")
	run:BindToRenderStep('Update',70,Function)
	script.Parent.Parent.Parent.Visible = true
end)
F = function()
	local s,e = pcall(function()
		local run = game:GetService("RunService")
		run:UnbindFromRenderStep('Update')
	end)
	if not s then
		print(e)
	end
	script.Parent.Parent.Parent.Visible = false
end
close.MouseButton1Click:Connect(F)
script.Parent.go.MouseButton1Click:Connect(function()
	local trys = 0
	local go
	repeat wait()
		local curuncy = script.Parent.YourSent.Text
		local playerFrom = game.Players.LocalPlayer
		local playerTo = script.Parent.Parent.Parent.PlayerSelected.Value
		print(curuncy)
		local ProductPurchaseDecision, other  = game.ReplicatedStorage.MoneyGive.SentGift:InvokeServer(curuncy,playerFrom,playerTo)
		
		if ProductPurchaseDecision==Enum.ProductPurchaseDecision.PurchaseGranted then
			go = true
		else
			go = false
			warn(other)
		end
		trys += 1
	until go or trys > 50
end)
script.Parent.Parent.Parent.player_.Changed:Connect(function(value)
	if value and value:IsA("TextButton") then
		value.MouseButton1Click:Connect(function()
			script.Parent.Parent.Parent.PlayerSelected.Value = value.Name
		end)
	end
end)

Please do not ask people to write entire scripts or design entire systems for you. If you can’t answer the three questions above, you should probably pick a different category.

1 Like

finally remembered that a remoteFunction first parameter is the player

2 Likes