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

What is wrong in my code? GUI Store doesn't want to work right

Hey,

So today, I followed GUI Shop video and made gui shop for my game. Sadly, on "Roblox Studio" testing it works, but when I publish it and try, it doesn't.

It opens up shop, but it doesn't show item name, desc, pic if u hover you're mouse over it and you can't buy it. ( Doesn't show u don't have enough Points etc.) all that works in ROBLOX Studio.

Here's the code: Maybe someone can help me fix it :)

local player = game.Players.LocalPlayer
local currency = player:WaitForChild('leaderstats').Points
local amount = 200
local tool = game.ServerStorage:WaitForChild('Dragon')
local indextext = script.Parent.Text
script.Parent.MouseButton1Click:connect(function()
	if currency.Value >= amount and not player.Backpack:FindFirstChild('Dragon') or player.Character:FindFirstChild('Dragon') then
		currency.Value = currency.Value - amount
		local newtool = tool:Clone()
		newtool.Parent = player.Backpack
		script.Parent.Text = 'Purchased! Thank You'
	else
		script.Parent.Text = 'Not enough Points'
		wait(1)
		script.Parent.Text = indextext
	end
end)

script.Parent.MouseEnter:connect(function()
	script.Parent.Parent.Parent.ProductPic.Image = 'rbxassetid://'..script.Imagevalue.Value
	script.Parent.Parent.Parent.ProductDesc.Text = script.Descvalue.Value
	script.Parent.Parent.Parent.ProductName.Text = script.Titlevalue.Value
end)

script.Parent.MouseLeave:connect(function()
	script.Parent.Parent.Parent.ProductPic.Image = 'rbxassetid://'
	script.Parent.Parent.Parent.ProductDesc.Text = ''
	script.Parent.Parent.Parent.ProductName.Text = ''
end)

1 answer

The client cannot access objects inside ServerStorage. Move the things that the client is supposed to access into ReplicatedStorage.

1 comment

0

Thank You Sir! You've solved my problem :)

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