i’m following the following tutorial but was modifying it to enable/disable based on what gear the player has (trying to make a cooking system)
here are my questions:
how do i fix the syntax error at line 21? Syntax Error: (21,10) Expected identifier when parsing variable name, got 'in'
is my loop scripted correctly/efficiently? for some additional context, the gear name changes to “Buldak Ramen” after the player clicks a model that isn’t a parent of “BuldakSpark,” so i want to disable the beam after they finish the recipe
if i wanted to make multiple beams for each step of the recipe, how would i add it to this script?
local Player = game.Players.LocalPlayer
local Char = Player.Character
local guide = game.Workspace["Cooking Kit (ramen test)"].Workspace.CookingSystem.Recipes
local function buldakGuidingArrow()
for i,v in pairs(guide.BuldakRamenRecipe.BuldakSpark) do
local beam = Instance.new("Beam")
beam.Parent = v
beam.Color = ColorSequence.new(Color3.fromRGB(0,0,0))
local attachmentPlayer = Instance.new("Attachment")
attachmentPlayer.Name = "guideToSeasoning"
attachmentPlayer.Parent = Char:WaitForChild("HumanoidRootPart")
beam.Attachment0 = v.Attachment
beam.Attachment1 = attachmentPlayer
end
end
for i,v, in pairs(Player.Backpack:GetChildren()) do
if v.Name == "Plain Ramen" then
buldakGuidingArrow() do
end
end
if v.Name == "Buldak Ramen" then
guide.BuldakSpark.Beam.Enabled = false
end
end
doesn’t work even when i remove the conditionals at the end
local Player = game.Players.LocalPlayer
local Char = Player.Character
local guide = game.Workspace["Cooking Kit (ramen test)"].Workspace.CookingSystem.Recipes
local function buldakGuidingArrow()
for i,v in pairs(guide.BuldakRamenRecipe.BuldakSpark) do
local beam = Instance.new("Beam")
beam.Parent = v
beam.Color = ColorSequence.new(Color3.fromRGB(0,0,0))
beam.Attachment0 = v.Attachment
beam.Attachment1 = Char:WaitForChild("HumanoidRootPart"):WaitForChild("RootAttachment")
end
end
buldakGuidingArrow()