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

local script working in studio mode but not play?

Asked by 9 years ago

cant find the problem :|

local choose = script.Parent.Choose
local a = game.Lighting.Choices:FindFirstChild(choose.Spin.TextLabel.Text)
    a:Clone().Parent = script.Parent.Parent.Parent.Backpack
    a:Clone().Parent = script.Parent.Parent.Parent.StarterGear
0
Is this a Script or a LocalScript? woodengop 1134 — 9y

1 answer

Log in to vote
0
Answered by 9 years ago

I'm guessing the problem is that the script is running before everything is loaded (you can check by looking at the developer console by pressing F9 in online mode: if you find an error that says something like "attempt to index [variable name here] (a nil value)" , that could be it) Try using "WaitForChild" commands instead of accessing children directly. ex:

local choose = script.Parent:WaitForChild("Choose")

If that's not the problem, having the error message from the developer console would help greatly.

Ad

Answer this question