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

Why isn't this require() working?

Asked by 8 years ago

I'm trying to require a script so it can change a company name

HIERARCHY (microsoft word got in the way :P) https://gyazo.com/111157437f318b143cf9886f1209db4b

sorry, i forgot to post the module scrito .-.

local module = {}

function module.text()
    local text = game.StarterGui.ChangeName.Frame.NewName1.Text
    script.Parent.SurfaceGui.TextLabel = text
end

return module

script

local modulescript = require(game.Workspace["KinqAndi's Tycoon Kit"].Tycoons.BlueTeam.PurchasedObjects.Sign.Name.ModuleScript)
modulescript.text()

error: 13:42:47.791 - Attempted to call require with invalid argument(s). 13:42:47.792 - Script 'Players.Player.PlayerGui.Button.TextButton.LocalScript', Line 101 13:42:47.794 - Stack End

script it connects to

script.Parent.Parent.Parent.ChangeName.Frame.Yes1.MouseButton1Click:connect(function()
                local text = game.StarterGui.ChangeName.Frame.NewName1.Text
                submit.Text = "One second..."
                wait(3)
                submit.Text = "Sucess!" 
                local modulescript = require(game.Workspace["KinqAndi's Tycoon Kit"].Tycoons.BlueTeam.PurchasedObjects.Sign.Name.ModuleScript)
                modulescript.text()
                end)

The WHOLE script

local frame = script.Parent.Parent.Parent:WaitForChild('ChangeName').Frame
local toggle = false
local yes = frame.Yes
local no = frame.No
local request = frame.Request
local new = frame.NewName
local submit = frame.Submit
local submit1 = frame.Yes1
local submit2 = frame.No1


script.Parent.MouseButton1Click:connect(function()
    if toggle == false then
frame:TweenPosition(UDim2.new(0.5,-200,0.5,-200), 'Out', 'Bounce', 1)
        toggle = true       
    else
frame:TweenPosition(UDim2.new(0.5,-250,1.6,-200), 'Out', 'Bounce', 1)
    end
end)

toggle1 = false
script.Parent.Parent.Parent.ChangeName.Frame.No.MouseButton1Click:connect(function()
    if toggle1 == false then
        for i =0,1,0.1 do
            yes.Transparency = i
            wait(0.1)
        end 
        wait(1)
        no:TweenPosition(UDim2.new(-0.26, 230, 0.6, 70), 'In', 'Linear', 1)
        wait(2)
        for v = 0,1,0.1 do
            no.Transparency = v
            wait(0.1)
        end
    end
end)

toggle2 = false
script.Parent.Parent.Parent.ChangeName.Frame.Yes.MouseButton1Click:connect(function()
    if toggle2 == false then
        for i =0,1,0.1 do
            no.Transparency = i
            wait(0.1)
        end 
        wait(1)
        yes:TweenPosition(UDim2.new(0.26, 40, 0.6, 70), 'Out', 'Linear', 1) 
        wait(2)
        for i = 0,1,0.1 do
            yes.Transparency = i
            wait(0.1)
        end
        for i = 0,1,0.1 do
            request.Transparency = i
            wait(0.1)
        end
        wait(1)
        for i = 1,0,-0.1 do
            new.Transparency = i
            wait(0.1)
        end
        wait(1)
        local name = Instance.new('TextBox')
        name.Parent = script.Parent.Parent.Parent.ChangeName.Frame
        name.Name = "NewName1"
        name.TextScaled = true
        name.TextWrapped = true
        name.Position = UDim2.new(0, 43, 0.5, 0)
        name.Size = UDim2.new(0, 250, 0, 100)
        name.MultiLine = true
        name.ClearTextOnFocus = true
        name.TextTransparency = 1
        name.BackgroundTransparency = 1
        name.Text = "Enter new name here"
        for i = 1,0,-0.1 do
            name.BackgroundTransparency = i
            name.TextTransparency = i
            wait(0.1)
        end 
        for i = 1,0,-0.1 do
            submit.BackgroundTransparency = i
            submit.TextTransparency = i
            wait(0.1)
        end
        script.Parent.Parent.Parent.ChangeName.Frame.Submit.MouseButton1Click:connect(function()
            if name.Text == "Enter new name here" then
                submit.Text = "Failed. Please write another name."
                wait(4)
                submit.Text = "Submit"
                else
                submit.Text = "Confirm this as your new name?"
                for i = 1,0,-0.1 do
                    submit1.Transparency = i
                    submit2.Transparency = i
                    wait(0.1)
                end
                script.Parent.Parent.Parent.ChangeName.Frame.Yes1.MouseButton1Click:connect(function()
                local text = game.StarterGui.ChangeName.Frame.NewName1.Text
                submit.Text = "One second..."
                wait(3)
                submit.Text = "Sucess!" 
                local modulescript = require(game.Workspace["KinqAndi's Tycoon Kit"].Tycoons.BlueTeam.PurchasedObjects.Sign.Name.ModuleScript)
                modulescript.text()
                end)
            end
        end)
    end
end)

Answer this question