22:03:30.531 - Players.Player1.PlayerGui.ScreenGui.Core:11: attempt to index a nil value 22:03:30.532 - Stack Begin 22:03:30.536 - Script 'Players.Player1.PlayerGui.ScreenGui.Core', Line 11 22:03:30.538 - Stack End
works in studio not play
local gui = script.Parent local frame = gui:findFirstChild("Frame",true) local setting = gui.Settings local openclose = setting.OpenClose local slide = setting.Slide local money = setting.MoneyType local keyd = setting.KeyDown local button = gui:findFirstChild("Button",true) local Player = script.Parent.Parent.Parent local mouse = Player:GetMouse() local list1 = gui:findFirstChild("Frame",true):findFirstChild("Frame1",true):GetChildren()
Using :FindFirstChild
is pointless if you're immediately going to access things on it (see line 11).
You should probably use :WaitForChild(name)
; this will definitely not return nil
because it freezes until there actually is an object there.
Also in my experience using more than one :
in a line of code, for example
workspace:FindFirstChild("yoyo").model:FindFirstChild("yoyoman").Size = Vector3.new(math.random(1,10), math.random(1,10), math.random(1,10))
would error. if you need to use more than one do it like this
yoyo = workspace:FindFirstChild("yoyo") brick = yoyo.model:FindFirstChild("yoyoman") brick.Size = Vector3.new(math.random(1,10), math.random(1,10), math.random(1,10))