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

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

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

2 comments

0

It was line 53

1

InputText isn't a valid member of NamerFolder.

1 answer

Like the comment said it cant find InputText inside NameFolder.

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