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

How to Make a GUI Shop with Scripting? (Client-Sided)

I made some GUIS, and then I put in a Local Script. I don't know where to start, but here is my code:

local frame = script.Parent
local TextButton = frame.TextButton

TextButton.MouseButton1Click:Connect(function(player)
game.ServerStorage.IronSword.Parent = player.Backpack
end)

Can someone help?

1 answer

✓ Accepted answer

I'm pretty sure you cannot acess the ServerStorage in run time, I'd recommend you putting the item within the ReplicatedStorage. Other than that you should also give the item in a server script as the local scripts only affect the client of that user.

Insert a remoteEvent in the replicatedStorage and fire it from your local script when you press the button. Then in a server script listen to this even and clone the item into the player backpack.

Please read this article, it helps a lot

https://developer.roblox.com/en-us/articles/Remote-Functions-and-Events

1 comment

0

prooheckcp I know about remote events, but I want to do it directly, Not though a Remote event/function.

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