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

Buying Something from GUI Not working on servers?

So I made a shop using a GUI. This works when I play in edit mode but when I play on an actual server it doesn't put the Cheezburger into my inventory. I've tried changing the Variable Tool to game.ServerStorage:WaitForChild('Cheezburger') but it didn't work. Any suggestions would be awesome. This is in a local script inside a image button.

local Player = game.Players.LocalPlayer
local Points = Player:WaitForChild('leaderstats').Points
local Tool = game.ServerStorage:FindFirstChild('Cheezburger')
script.Parent.MouseButton1Down:connect(function()
	if Points.Value >= 45 and not Player.Backpack:FindFirstChild('Cheezburger') or Player.Character:FindFirstChild('Cheezburger') then
		local NewTool = Tool:Clone()
		NewTool.Parent = Player.StarterGear
		local NewTool = Tool:Clone()
		NewTool.Parent = Player.Backpack
	end
end)

1 answer

✓ Accepted answer

LocalScripts can't see things in ServerStorage

Consider moving it to ReplicatedStorage, or even better consider moving your logic to the server and using a RemoteEvent to tell the server to do it.

1 comment

0

Moving the Tool to replicated storage fixed the problem. Thanks Elunate!

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