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

What do i do abotu attempt to index nil with 'Clone'?

Asked by 4 years ago
Edited 4 years ago

so im making a simple shop and ive ran into a problem. im trying to test if the gears will appear in guis named template. when i test it i get this error:Players.ManChild266.PlayerGui.Shop.LocalScript:8: attempt to index nil with 'Clone'.

heres my code:local folder = game.ReplicatedStorage:WaitForChild("Tools")

local frame = script.Parent:WaitForChild("Frame")

local temnplate = frame:WaitForChild("Template")

for _, tool in pairs(folder:GetChildren()) do local newTemplate = template:Clone() newTemplate.Name = tool.Name newTemplate.ObjectName.Text = tool.Name newTemplate.Visible = true newTemplate.Parent = frame end

1 answer

Log in to vote
0
Answered by 4 years ago

On the line where you state the template variable you spelled it wrong and said "temnplate". Change it to "template".

Hope this helped. Also use codeblock in the next question you ask.

Ad

Answer this question