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

Shop GUI works when tested in studio but not in-game?

Asked by 8 years ago

So my script works perfectly when I test in studio, but in-game it doesn't do anything. Anyone know why?

P.S. This script is inside a text button that is inside a scrolling frame (in a screen GUI that is in starter GUI)

local player = game.Players.LocalPlayer
local currency = player:WaitForChild('leaderstats').Points
local amount = 45
local tool = game.ServerStorage:WaitForChild('Bloxiade')
local indextext = script.Parent.Text
script.Parent.MouseButton1Click:connect(function()
    if currency.Value >= 45 and not player.Backpack:FindFirstChild('Bloxiade') or player.Character:FindFirstChild('Bloxiade') then
        --They Don't Have It
        currency.Value = currency.Value - amount
        local newtool = tool:Clone()
        newtool.Parent = player.Backpack
    else
        script.Parent.Text = 'Purchase Unsuccessful'
        wait(0.5)
        script.Parent.Text = indextext
    end
end)

script.Parent.MouseEnter:connect(function()
    script.Parent.Parent.Parent.ProductImage.Image = "rbxassetid://"..script.ImageValue.Value
    script.Parent.Parent.Parent.Description.Text = script.DescValue.Value
    script.Parent.Parent.Parent.ProductTitle.Text = script.TitleValue.Value
end)
script.Parent.MouseLeave:connect(function()
    script.Parent.Parent.Parent.ProductImage.Image = "rbxassetid://"
    script.Parent.Parent.Parent.Description.Text = ""
    script.Parent.Parent.Parent.ProductTitle.Text = ""
end)
0
It is a local script btw kelimeguy 60 — 8y
0
Put this at the very beginning of your script: repeat wait() until game.Players.LocalPlayer; Validark 1580 — 8y
0
add repeat wait() until game.Players.LocalPlayer HungryJaffer 1246 — 8y
0
Wait a second, is repeat wait() until game.Player.LocalPlayer one line or two? kelimeguy 60 — 8y

Answer this question