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

This variable never works in game and only in studio, any solutions?

Asked by 6 years ago

This variable hole = tool.Hole doesn't work in game

local tool = script.Parent.Parent
local hole = tool.Hole

is there anyway to fix this?

1 answer

Log in to vote
1
Answered by
Azarth 3141 Moderation Voter Community Moderator
6 years ago
Edited 6 years ago

If you check the output it probably says something like "Hole is not a member of -Parent name here-". The error is because the script can't find Hole, because it hasn't been created yet. Utilize WaitForChild() on children.

local tool = script.Parent.Parent
local hole = tool:WaitForChild("Hole")
0
ok KatsuneSniper 31 — 6y
Ad

Answer this question