Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

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

Asked by
Jartsu 0
8 years ago

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

Log in to vote
0
Answered by
1waffle1 2908 Trusted Badge of Merit Moderation Voter Community Moderator
8 years ago

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

0
Thank You Sir! You've solved my problem :) Jartsu 0 — 8y
Ad

Answer this question