So this is my lightning script for my game and for some reason it stopped working at the zap function when I try to do bolt()
function bolt(pos) local CF = CFrame.new(workspace.Cloud.Position, pos) -- error local sound = script.StrikeSound:clone() sound.Volume = 1 sound.Name = "Temp"..sound.Name sound.Parent = script game.Debris:AddItem(sound,10) for strike = 1, 8 do local lastPos = CF.p local Parts = 7 local Arc = 20 game.Lighting.Ambient = script.Flash.Value for i = 1, Parts do local targpoint = CF.p + ((CF.lookVector*((CF.p-pos).magnitude/Parts))*i) + Vector3.new(math.random(-Arc,Arc),math.random(-Arc,Arc),math.random(-Arc,Arc)) -- eror if i == Parts then targpoint = pos end local s = Instance.new("Part") s.formFactor = 0 s.Size = Vector3.new(1,1,math.floor((lastPos-targpoint).magnitude)) s.CFrame = CFrame.new((lastPos+targpoint)/2,targpoint) s.BrickColor = BrickColor.new("Bright yellow") s.Anchored = true s.CanCollide = false local m = Instance.new("BlockMesh") m.Scale = Vector3.new(5,5,1) m.Parent = s local sc = script.BoltScript:clone() print'incoming lightning' sc.Disabled = false sc.Parent = s s.Parent = workspace lastPos = targpoint end wait(0.07) game.Lighting.Ambient = script.Storm.Value wait(0.01) end end
FindFirstChild expects a string, chosen is an object. Use chosen.Name instead of just chosen on line 53.