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

Attempt index nil with 'Text' Can Anyone help me?

Asked by 4 years ago

I tried to make a sandbox placement system but i got an error:

local Player = game.Players.LocalPlayer
local Mouse = Player:GetMouse()
local btn = script.Parent
local frame = script.Parent.Parent
local NameFolder = frame.Name
local ColorFolder = frame.Color

local canStart = true
local isPlacing = nil
local canPlace = nil

local PosX
local PosY
local PosZ

local Model = game.ReplicatedStorage.Model:Clone()

local GridSize = 4

local function Snap()
    PosX = math.floor(Mouse.Hit.X / GridSize + 0.5) * GridSize
    PosY = 2
    PosZ = math.floor(Mouse.Hit.Z / GridSize + 0.5) * GridSize
end

local function Movement()
    Mouse.TargetFilter = Model

    Snap()

    Model:SetPrimaryPartCFrame(CFrame.new(PosX, PosY, PosZ))
end

local function StartPlacementModel()
    if canStart then
        Model = game:GetService("ReplicatedStorage").Model:Clone()
        Model.Parent = workspace
        Model.PrimaryPart.Transparency = 0.5
        isPlacing = true    
        canPlace = true
        canStart = false

        Mouse.Move:Connect(Movement)
    end
end

local Name
local ColorRed
local ColorGreen
local ColorBlue

btn.MouseButton1Click:Connect(function()
    Name = NameFolder.InputText.Text
    ColorRed = ColorFolder.GreenColor.Text
    ColorGreen = ColorFolder.GreenColor.Text
    ColorBlue = ColorFolder.BlueColor.Text
end)

local function Placement()
    if isPlacing and canPlace then
        local PlacedModel = Model:Clone()
        PlacedModel.Parent = workspace.PlacedObjects
        PlacedModel.PrimaryPart.Transparency = 0
        PlacedModel.PrimaryPart.Anchored = true
        PlacedModel.Name = Name
        PlacedModel.Color  = Color3.new(ColorRed, ColorGreen, ColorBlue)

        isPlacing = false
        canPlace = false
        canStart = true

        Model:Destroy()
    end
end





Mouse.Button1Down:Connect(Placement)

PLEASE HELP

0
It was line 53 FireDreamGames 17 — 4y
1
InputText isn't a valid member of NamerFolder. Nickuhhhhhhhhhhhhhhh 834 — 4y

1 answer

Log in to vote
0
Answered by 4 years ago

Like the comment said it cant find InputText inside NameFolder.

Ad

Answer this question