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

Erm guys this doesnt work no errors no nothing at all can anyone figure this out?

(no errors or anything at all) This is the first script in a localscript inside a button:

local SG = game.StarterGui
local elk = require(game.ReplicatedStorage.ModuleScript)

local one = elk.Dragon
local two = elk.Lion
local three = elk.TRex
local four = elk.Dolphin
local five = elk.Wolf

function onefunc()
    SG.ScreenGui.Frame.PETNAME.Text = "Dragon"
    SG.ScreenGui.Frame.PETCOST.Text = one.Cost
    SG.ScreenGui.Frame.PETLEVEL.Text = one.Level
end

function twofunc()
    SG.ScreenGui.Frame.PETNAME.Text = "Lion"
    SG.ScreenGui.Frame.PETCOST.Text = two.Cost
    SG.ScreenGui.Frame.PETLEVEL.Text = two.Level
end

function threefunc()
    SG.ScreenGui.Frame.PETNAME.Text = "TRex"
    SG.ScreenGui.Frame.PETCOST.Text = three.Cost
    SG.ScreenGui.Frame.PETLEVEL.Text = three.Level
end

function fourfunc()
    SG.ScreenGui.Frame.PETNAME.Text = "Dolphin"
    SG.ScreenGui.Frame.PETCOST.Text = four.Cost
    SG.ScreenGui.Frame.PETLEVEL.Text = four.Level
end

function fivefunc()
    SG.ScreenGui.Frame.PETNAME.Text = "Wolf"
    SG.ScreenGui.Frame.PETCOST.Text = five.Cost
    SG.ScreenGui.Frame.PETLEVEL.Text = five.Level
end

script.Parent.MouseButton1Click:Connect(function()
    if SG.ScreenGui.Frame.PETNAME.Text == "Label" then
        onefunc()
    elseif 
        SG.ScreenGui.Frame.PETNAME.Text == "Dragon" then
            twofunc()
            elseif
                SG.ScreenGui.Frame.PETNAME.Text == "Lion" then
                    threefunc()
                    elseif
                        SG.ScreenGui.Frame.PETNAME.Text == "TRex" then
                            fourfunc()
                            elseif
                                SG.ScreenGui.Frame.PETNAME.Text == "Dolphin" then
                                    fivefunc()
                                    elseif
                                        SG.ScreenGui.Frame.PETNAME.Text == "Wolf" then
                                            onefunc()
    end
end)

Second script is a modulescript in repstorage:

local module = {

    ["Dragon"] = {
         ["Cost"] = 1000;
         ["Level"] = 10;
};

    ["Lion"] = {
         ["Cost"] = 750;
         ["Level"] = 5;
};

    ["TRex"] = {
         ["Cost"] = 600;
         ["Level"] = 4;
};

    ["Dolphin"] = {
         ["Cost"] = 450;
         ["Level"] = 3;
};

    ["Wolf"] = {
         ["Cost"] = 180;
         ["Level"] = 1;
};

}


return module

1 answer

✓ Accepted answer

right now you're changing properties of things in StarterGui

instead, try this instead

local SG = game.Players.LocalPlayer.PlayerGui

2 comments

0

Can you mark as answered?

0

yellp = BIG BRAINER :P

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