Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

Sending information to server?

So in my shop gui I want to have only 1 function that fire every time I click any of the purchase buttons. In the purchase button script it will check its parent's name and send that to the server but I don't actually know how to do this

I tried doing this but obviously it doesn't work.

In the purchase localscript:

script.Parent.MouseButton1Down:Connect(function()
	local Price = 20
	game.ReplicatedStorage.PurchaseApple:FireServer(Price)
end)

In the ServerScriptService

game.ReplicatedStorage.PurchaseApple.OnServerEvent:Connect(function(Price)
	print(Price)
end)

Instead it just prints the playername

1 answer

✓ Accepted answer

When server script receives remote from client first parameter is always the player that sends it so your code should have this in server script:

...:Connect:(function(Player,Price)

Note: I can't use code block as I am on phone and it doesnt work for some reason so here is only part that has to be changed

1 comment

0

correct.

This discussion is preserved as it was. New answers, comments, and votes are closed.